为什么在众多数据结构中,字典操作总是逃不开最坏情况的魔咒?
- 内容介绍
- 文章标签
- 相关推荐
本文共计423个文字,预计阅读时间需要2分钟。
How dict is implemented for linear-time lookup in collisions? I assume it uses a hash table with a list as the backing structure.
Howexactlyisdictimplementedthatithasalineartimelookupforcollisions?IwouldassumethatHow exactly is dict implemented that it has a linear time lookup for collisions? I would assume that it is implemented as a hashtable backed by a list. I would presume that a better implementation would be O(log(n)) for various operations, using a tree to back the table instead. Is there some magic happening behind the scenes to keep the constant time lookups alive for as long as possible?
dict究竟是如何实现的,它具有线性时间查找冲突?我认为它是作为由列表支持的哈希表实现的。我认为对于各种操作,更好的实现将是O(log(n)),而使用树来代替表。
本文共计423个文字,预计阅读时间需要2分钟。
How dict is implemented for linear-time lookup in collisions? I assume it uses a hash table with a list as the backing structure.
Howexactlyisdictimplementedthatithasalineartimelookupforcollisions?IwouldassumethatHow exactly is dict implemented that it has a linear time lookup for collisions? I would assume that it is implemented as a hashtable backed by a list. I would presume that a better implementation would be O(log(n)) for various operations, using a tree to back the table instead. Is there some magic happening behind the scenes to keep the constant time lookups alive for as long as possible?
dict究竟是如何实现的,它具有线性时间查找冲突?我认为它是作为由列表支持的哈希表实现的。我认为对于各种操作,更好的实现将是O(log(n)),而使用树来代替表。

