logo

AQA A-Level Computer Science practice

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

Try the question first, then check the answer and practise the same topic again.

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

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.

Related flashcards

No flashcards are published for this page yet.

Related practice questions