Write and execute a program that can read 16 numbers from keyboard and do the Binary search on them. procedure binary search(x: integer, a ,a ., a : increasing integers) 2 i:= 1 {i is the left...

Write in c++ and And reverse algorithm to search from right to leftWrite and execute a program that can read 16 numbers from keyboard<br>and do the Binary search on them.<br>procedure binary search(x: integer, a ,a ., a : increasing integers)<br>2<br>i:= 1 {i is the left endpoint of interval}<br>j:= n {j is right endpoint of interval}<br>while i<j<br>m := [(i +j)/2]<br>if x > a then i:= m + 1<br>else j:= m<br>if x = a then location := i<br>i<br>else location := 0<br>return location{location is the subscript i of the term a equal to x,<br>or 0 if x is not found}<br>

Extracted text: Write and execute a program that can read 16 numbers from keyboard and do the Binary search on them. procedure binary search(x: integer, a ,a ., a : increasing integers) 2 i:= 1 {i is the left endpoint of interval} j:= n {j is right endpoint of interval} while i a then i:= m + 1 else j:= m if x = a then location := i i else location := 0 return location{location is the subscript i of the term a equal to x, or 0 if x is not found}

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here