A computer is performing a binary search on the sorted list of 7 numbers below. What is the maximum number of iterations needed to find the item? [1, 5, 20, 50, 51, 80, 99] code example
Example: Implement a binary search of a sorted array of integers Using pseudo-code.
1.Let min = 0 and max = n-1.
2. Compute guess as the average of max and min, rounded down (so that it is an integer).
3. If array[guess] equals target, then stop. You found it! Return guess.
4. If the guess was too low, that is, array[guess] < target, then set min = guess + 1.
5. Otherwise, the guess was too high. Set max = guess - 1.
6. Go back to step 2.