Which is faster to find an item in a hashtable or in a sorted list?

后端 未结 7 2053
栀梦
栀梦 2020-12-24 06:41

Which is faster to find an item in a hashtable or in a sorted list?

相关标签:
7条回答
  • 2020-12-24 07:40

    HashTable would be more efficient for list containing more than 10 items. If the list has fewer than 10 items, the overhead due to hashing algo will be more.

    In case you need a fast dictionary but also need to keep the items in an ordered fashion use the OrderedDictionary. (.Net 2.0 onwards)

    0 讨论(0)
提交回复
热议问题