Question: Show the steps of the binary search algorithm (pseudocode is given below); low = index of first item in list high = index of last
Show the steps of the binary search algorithm (pseudocode is given below);
low = index of first item in list high = index of last item in list while low is less than or equal to high mid = index halfway between low and high if item is less than list[mid] high = mid - 1 else if item is greater than list[mid] low = mid + 1 else return mid end while return not found
For each step of the algorithm, give the indexes of first, last, and middle when searching for "Deb" in the following list.
"Alf" "Ann" "Bev" "Bob" "Deb" "Jed" "Jim" "Joe" "Liz" "Meg" "Ned" "Sam" "Sue" "Wes" "Zed" [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
