Quarry School

Search, sort and cost

Subject: ComputingLevel 1 · estimated

Search a row of cards one by one and by halves, put cards in order two ways, and count the comparisons each procedure makes as the row grows.

Lessons

Quick review

Read the whole unit on one page

  1. Count comparisons in a linear searchSubject: ComputingLevel 1 · Foundations
  2. Keep a sorted interval for binary searchSubject: ComputingLevel 1 · Foundations
  3. Insert one card into sorted orderSubject: ComputingLevel 1 · Foundations
  4. Trace a sort on repeated keysSubject: ComputingLevel 1 · Foundations
  5. Compare work as the collection doublesSubject: ComputingLevel 1 · Foundations

Sources

  1. AP Computer Science Principles Course and Exam Description. College Board. All rights reserved. Read 2 Dec 2026. Cited in Count comparisons in a linear search, Keep a sorted interval for binary search, Compare work as the collection doubles.
  2. Computer Science Field Guide: Algorithms, 2.2 Searching. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 2 Dec 2026. Cited in Count comparisons in a linear search, Keep a sorted interval for binary search, Compare work as the collection doubles.
  3. Computer Science Field Guide: Algorithms, 2.3 Sorting. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 2 Dec 2026. Cited in Count comparisons in a linear search, Insert one card into sorted order, Trace a sort on repeated keys, Compare work as the collection doubles.