Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed
image text in transcribed
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions