SortedList, ArrayList, Stack or switch()
C#
2
Posts
2
Posters
0
Views
1
Watching
-
Where to put some(about 300) certain strings(the list exists forever and I am not going to insert or remove any string) to find out quickly if a new string is among them? SortedList, ArrayList, Stack, switch() or something else?
If you want almost constant lookup time (O(1)), use a hashtable. I think that a switch also uses a hash table, I'm not sure though. A Stack is a bad option, a SortedList works faster than an ArrayList, since you add items to the list only once. Regards Senthil