I just read the tutorial “Finding Values in an Array”. Sure, the code works, but that’s only because we are searching arrays the contain a small number of elements.
Suppose we have n elements in an array. To search that array for a particular element we may have to do n comparisons.
If the array we are searching contains 10 million elements, we have a problem; can you imagine doing “if (this == that)” 10 million times?
There’s got to be a better way to search the array. Or perhaps we shouldn’t use arrays to store the information.
Anybody has any ideas?