Binary search array

Does anyone know if a good tutorial or youtube video to explain a binary search in an array?
1. User provides an array, the search target, and the range to search in.
2. If lower bound of range is higher than upper bound of range, return -1 (target not in array).
3. Find the midpoint of the range.
4. If value at midpoint is equal to search target, return midpoint.
5. If value at midpoint is lower than target, set the lower bound of range to midpoint + 1.
6. If value at midpoint is higher than target, set the upper bound of range to midpoint - 1.
7. Go to step 2.

NOTE: This assumes the array is sorted into ascending order.
Last edited on
I guess I should have asked for an example of how it is coded.
http://video.franklin.edu/Franklin/Math/170/common/mod01/binarySearchAlg.html

Try not to make posts that you could easily solve yourself by visiting google.
Topic archived. No new replies allowed.