in reply to Re: searching an array
in thread searching an array

This is really up to the problem.

If your problem demands one (or few) lookups you are better off scanning through the array, esp. if the array is huge or memory is short. If The array is sorted you can optimize this using a binary search algorithm.
If you have many lookups and you can easily pay the price of memory, then the hash solution is appropriate.


holli, /regexed monk/