HashDoS: how can worst case complexity of Hashtable be O(n^2)?

旧巷老猫 提交于 2019-12-06 12:23:47

The question is worded in an incorrect way. The researchers do not claim that "the worst case complexity of Hashtables is O(n^2)".

What they claim is that "The [...] complexity of inserting n elements into the table [...] goes to O(n^2)." So, the complexity of a single operation is O(n). Which makes sense: if all keys have the same hash, then they all go into the same bucket, which is just an array or a linked list, so it needs to be searched linearly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!