Nguyen_Khac_Trung's blog

By Nguyen_Khac_Trung, history, 2 years ago, In English

What is the complexity of st.erase(st.begin())?

| Write comment?
»
2 years ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

It should be O(logn)

»
2 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

What st is? What cppreference tell about it?

»
2 years ago, hide # |
Rev. 2  
Vote: I like it +3 Vote: I do not like it

Is st a set? If so, then it's O(log n), but it seems like your st is a string, in which case it's O(n).