Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLS ASAP!!! I will good vote the answer Assume that you are using binary search algorithm to find the position of element x=9 in the

image text in transcribed

image text in transcribed

PLS ASAP!!! I will good vote the answer

Assume that you are using binary search algorithm to find the position of element x=9 in the list L={1,2,3,4,5,6,7,8,9,10). What is the number of comparisons done by the algorithm until it finds the position of x? (Include all comparisons in your count!) Binary search algorithm is given as: procedure binary search(x: integer, a7,a2..., an: increasing integers) i:=1 {i is the left endpoint of interval} j:=n{j is right endpoint of interval} while i am then i:=m+1 else j:=m if x = a then location :=1 else location := 0 return location Select one: O a. 10 O b.5 O c.8 O d.6 Assume that you are using binary search algorithm to find the position of element x=9 in the list L={1,2,3,4,5,6,7,8,9,10). What is the number of comparisons done by the algorithm until it finds the position of x? (Include all comparisons in your count!) Binary search algorithm is given as: procedure binary search(x: integer, a1,22,..., an: increasing integers) i:= 1 {i is the left endpoint of interval} j:=n{j is right endpoint of interval} while i am then i:=m+1 else j:=m if x = a; then location :=i else location := 0 return location

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

Step: 3

blur-text-image

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

Students also viewed these Databases questions