Posted By:
Lasse_Koskela
Posted On:
Wednesday, December 11, 2002 12:17 AM
If the items in the list are not ordered, that is the only way. If the items would be ordered based on some rule, e.g. names in alphabetical order, you could apply some classic search algorithm (quicksort for instance), which would limit the needed "iterations" to a fraction of the linear search you are using currently.
This is however applicable only for bigger lists. It's probably more efficient to just go through the 5-10 items in a list than to apply a search algorithm...