Exam-style question
Try this first
Why must the data be ordered before binary search is used?.
- A.The algorithm uses the order to decide which half can be discarded
- B.The algorithm can only store ordered values
- C.Ordering makes every search take exactly one comparison
- D.The algorithm changes the values into numbers
Answer and explanation
Concise answer
The algorithm uses the order to decide which half can be discarded
Why this is correct
After checking the middle value, binary search compares it with the target. The ordering allows the algorithm to discard the half that cannot contain the target.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
