Question: else j : = m end if x = a i then location : = i else location : = 0 Vbrace location is the
else :
end
if then location :
else location :
Vbrace location is the subscript of term equal to or if is not found rbrace
Suppose our list of increasing integers is shown in the table below
Suppose we conduct the binary search algorithm on this list where we search for
a In the language of the algorithm above, enter the correct values for the following variables for this particular search:
b After the first iteration of the while loop, what are the values of the following variables?
c Intuitively, after the first iteration of the while loop, we have cut down our search to a set S of roughly half of the original numbers on the list. Check the numbers that are in the set S after the first iteration of the while loop:
has the following elements:
A
B
C
D
E
F
G
H
d After the second iteration of the while loop, some of the variables have altered values. Enter the values of the following variables after the second while loop iteration:
e After the third iteration of the while loop, some of the variables have altered values. Enter the values of the following variables after the third while loop iteration:
f After the rd iteration of the while loop, the while loop terminates and the variable 'location' is computed. Enter the value for this variable in this case: location
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
