This presentation should give you a visual overview of what is happening during an iterative implementation of binary search on an array.
- Notice that the array must be sorted in order to do binary search (why?)
- Higher level should also look up the recursive implementation.
- What is the time complexity of binary search? In other words, how many loops do you have to do for an array of N elements?
binary search of array animation