What is the time complexity of stack.push(string)?

Revision en1, by i_am_eating_wa_and_tle, 2024-03-01 11:35:50

As far as I know stack.push() have a O(1) time complexity but is it actually correct if I use a stack of string.

stack<string> stringStack;
string inputString;
while(cin >> inputString) {
    stringStack.push(inputString); // what is the time complexity of this line
}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English i_am_eating_wa_and_tle 2024-03-01 11:35:50 339 Initial revision (published)