This exercise refers to the binary search algorithm given below.

procedure binary search ( x : integer, : increasing integers)
i := 1 \lbrace i is left endpoint of search interval \rbrace
j := n \lbrace j is right endpoint of search interval \rbrace
while i j
begin

m :=

if then i := m + 1

else j := m
end
if then location := i
else location := 0
\lbrace location is the subscript of term equal to x , or 0 if x is not found \rbrace


Suppose our list of increasing integers is shown in the table below
34789111215
Suppose we conduct the binary search algorithm on this list where we search for 12.

(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:











(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 3rd 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 =

You can earn partial credit on this problem.