Question DSA-SRCH-0006
EasyWhy is mid often computed as lo + (hi − lo) / 2 instead of (lo + hi) / 2?
- A.
To avoid integer overflow when lo and hi are large
- B.
It finds the last element
- C.
Show answer and explanation
Answer: A
lo + hi can exceed the maximum int value in languages like C and Java.