I'd still check a map solution, just to be sure.
Also, your data is sorted, which means that a linear search on the data is not the most efficient algorithm. You should either implement a binary search, use an existing implementation, or keep your data unsorted.
----
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: The fastest way of searching a certain element in an array
by hardburn
in thread The fastest way of searching a certain element in an array
by ccn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |