logo

Question detail

Why must the data be ordered before binary search is used?

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Searching algorithms

Exam-style question

Try this first

Why must the data be ordered before binary search is used?.

  1. A.The algorithm uses the order to decide which half can be discarded
  2. B.The algorithm can only store ordered values
  3. C.Ordering makes every search take exactly one comparison
  4. D.The algorithm changes the values into numbers

Model answer

What a good answer should say

  • The algorithm uses the order to decide which half can be discarded

Explanation

Why this works

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.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.