Best Collection for Fast String Lookup

后端 未结 7 1676
别跟我提以往
别跟我提以往 2020-12-30 22:28

I need a list of strings and a way to quickly determine if a string is contained within that list.

To enhance lookup speed, I considered SortedList and

7条回答
  •  孤城傲影
    2020-12-30 22:50

    If you feel like rolling your own data structure, use a Trie. http://en.wikipedia.org/wiki/Trie

    worst-case is if the string is present: O(length of string)

提交回复
热议问题