在Python中使用字典时,这个页面表示迭代字典元素的时间复杂度是O(n),字典n的最大大小在哪里.
O(n)
n
但是,我不认为有一种显而易见的方法来遍历哈希表的元素.我可以假设dict.iteritems()在迭代哈希表的元素时有很好的性能,而没有太多的开销吗?
dict.iteritems()
由于字典在Python中被大量使用,我认为这是以一种聪明的方式实现的.不过,我需要确定一下.
python performance time-complexity python-internals
performance ×1
python ×1
python-internals ×1
time-complexity ×1