m.khooryani's blog

By m.khooryani, history, 8 years ago, In English

why my solution got TLE?

problem?

isn't sortedlist operations in lg n?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Not for all operations, https://msdn.microsoft.com/en-us/library/ms132339(v=vs.110).aspx .

It seems that read operations are and O(1), but modifications can be O(n) . It is probably implemented as list where elements are stored in sorted order not a tree (thus the name SortedList). It means that inserting and removing can cause shifting of all the elements.