in Unknown Category edited by
194 views
1 vote
1 vote

The program written for binary search, calculates the midpoint of the span as $\text{mid : =(Low+High)/2}$. The program works well if the number of elements in the list is small (about $32,000$) but it behaves abnormally when the number of elements is large. This can be avoided by performing the calculation as:

  1. $\text{mid :=(High-Low)/2+Low}$
  2. $\text{mid :=(High-Low+1)/2}$
  3. $\text{mid :=(High-Low)/2}$
  4. $\text{mid :=(High+Low)/2}$
in Unknown Category edited by
by
194 views

1 Answer

1 vote
1 vote
Eliminate option D due to it's same as the defective one.

considering Low index $=10,$ high index $= 15$

option B gives, mid index $= 3$ which is not even in the sub array index.

option C gives, mid index $= 2$ which is not even in the sub array index.

Option A is correct.
edited by
Answer:

Related questions