1.

The program written for binary search, calculates the midpoint of the span as 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:

A. mid : = (High - Low)/2 + Low
B. mid : = (High - Low + 1)/2
C. mid : = (High - Low)/2
D. mid : = (High + Low)/2
Answer» B. mid : = (High - Low + 1)/2


Discussion

No Comment Found