This page explains the concept of Array Searches.

Description Sample Code

Liner Search Approach

          The Liner Search Approach is pretty strait forward, all that is really done is the array is looped thoug from the begining to the end while looking for a single value. While this can be done with fairly small array with decent effeciency, when the array starts to get the size of 1,000 or more effeciency starts to drop off and there is a noticable pause in the program. Thats where the next sort comes into play.

code

Binary Search Approach

          Binary Search is strait forward as well, you find the middle of the array and from there you are able to eather elimanate half the list right away, and sometimes have the list plus one. The way you start at the center of the array is you take the high, which is the array length-1, and subtract it by the low, which is always zero, and devide the answer by two. Then you check to see if the number is higher or lower then the middle of the array. If there is no match then a -1 is returned, otherwise the match will be returned. The only error that thends to heappen with the binary search is, if the array size is one then both min and max is zero, thus will miss the match. This Approach also works with multiple matches being in the array since it will find one of them.

code