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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started