Блог пользователя Yousef_Sameh

Автор Yousef_Sameh, история, 4 года назад, По-английски

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.

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
← Rev. 3  
Проголосовать: нравится +12 Проголосовать: не нравится

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)

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

You should read this.