Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4 points) This exercise reters to the binary search algonithm given below. binary search (x: integer, a,a2 an increasing integers) 1 iis left endpoint of
4 points) This exercise reters to the binary search algonithm given below. binary search (x: integer, a,a2 an increasing integers) 1 iis left endpoint of search interval ) j:# n {j is right endpoint of search interval } whilei a," then i :-m+1 else j := m end if x = ai then location : else location0 location is the subscript of term equal to x, or 0 if x is not found) Suppose our list of increasing integers is shown in the table below 45611 12 131 Suppose we conduct the binary search algorithm on this list where we search for 13. (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: S has the following elements: OA. 12 . 15 Oc. 11 OD. 5 OE. 13 OG.2 H. 4
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