TopMyGrade

Home·Daily Problem

Daily Problem·Thursday, 6 July 2023Back to today

Linear vs binary search comparison

GCSE · Computer Science · OCR · 2.1.3 — Searching algorithms: linear search and binary search; preconditions, step counts and trade-offs

Question

Compare linear search and binary search. Your answer should include: when each is appropriate, and their efficiency. [6 marks]

Mark scheme (levels-based):

L2 (3–4): Describes both algorithms; identifies key differences (sorted list requirement; efficiency).

L3 (5–6): Sustained comparison: linear requires no precondition → versatile; best for small or unsorted lists. Binary requires sorted list → sorting overhead if not already sorted; far more efficient for large sorted lists (log₂n vs n worst case). Example: searching 1 million items — binary max 20 comparisons, linear max 1 million. Binary search should be used when the list is large AND already sorted; linear when the list is small or unsorted.

6 marks · take your time before peeking.

Sign up to try the next 30 problems

Save your streak, mark answers against the spec, and build a daily revision habit. Free during public beta — no card, no auto-renew.

Generated by TopMyGrade AI · cross-check official sources before relying on the mark-scheme phrasing.