Nguyen_Khac_Trung's blog

By Nguyen_Khac_Trung, history, 13 months ago, In English

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

  • Vote: I like it
  • +1
  • Vote: I do not like it

| Write comment?
»
13 months ago, # |
  Vote: I like it +14 Vote: I do not like it

It should be O(logn)

»
13 months ago, # |
  Vote: I like it +1 Vote: I do not like it

What st is? What cppreference tell about it?

»
13 months ago, # |
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).