Yousef_Sameh's blog

By Yousef_Sameh, history, 14 months ago, In English

in this problem when I used an unordered map I got TLE and used the same solution with map I got ACC I need an explanation, please

I really appreciate any help you can provide.

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

| Write comment?
»
14 months ago, # |
Rev. 3   Vote: I like it +12 Vote: I do not like it

Because Unordered map(HashTable) has worst case time complexity of O(n^2). That happens in case of collisions and since there was hacking available. Hackers added anti-hash tests so it got the unordered map to have O(n^2) and thus TL

Map(Self Balancing BST) always O(log n)

»
14 months ago, # |
  Vote: I like it 0 Vote: I do not like it

You should read this.