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

Правка en1, от 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
}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский i_am_eating_wa_and_tle 2024-03-01 11:35:50 339 Initial revision (published)