Grade 10 · unit review

Review: Prepare and Compare Searches

Sort data, count search inspections and trace a first-match binary-search variant.

Bring the unit skills together

Use these 4 new cases to check your reasoning. Choices are temporary and are not saved to an account, sent to staff or recorded as school grades. Download your current review choices before leaving or reloading.

Unit review questions
1. Sorted list [2, 6, 10, 14, 18, 22, 26], target 22. What is the second inspected value under middle-item binary search?
2. Linear first-match search on [9, 1, 7, 4], target 7: what are returned position and inspections?
3. Insertion sort starts with [5, 3, 4]. After inserting the first key 3, what is the full list?
4. Lower-bound search uses sorted [1, 3, 3, 6], target 3. Which zero-based position is returned?

The download contains your current choices and any checked feedback. Keep the separate transfer-task work in your own document; downloading its instructions does not mark it complete.

Use the skills in a new task

Prepare fictional codes [8, 2, 5, 2] for first-match searching. Trace insertion-sort passes, then lower-bound search for 2 on the sorted list. Also trace linear first-match search for 5 on the original list and middle-item binary search for 8 on the sorted list, choosing floor((lo+hi)/2) for inclusive binary bounds. Compare inspected-item counts without counting sorting as free.

Work on paper or in your own document. Explain the choices you made.

  • Sort with passes [2,8,5,2], [2,5,8,2], [2,2,5,8].
  • Find the first 2 at sorted position 0 using lower-bound, inspecting positions 2,1,0.
  • Linear search for 5 on original list returns position 2 after 3 inspections.
  • Inclusive-bound binary search for 8 inspects values 2,5,8: 3 inspections; state sorting preparation has additional work.
Compare with a model response

Insertion-sort passes: [2,8,5,2] → [2,5,8,2] → [2,2,5,8]. Lower-bound target 2: range [0,4), mid 2 value 5; then [0,2), mid 1 value 2; then [0,1), mid 0 value 2; return 0 after 3 inspections. Linear target 5 on [8,2,5,2] inspects 8,2,5 and returns position 2 after 3 inspections. Binary target 8 with inclusive bounds 0..3 inspects positions 1,2,3, values 2,5,8, also 3 inspections. These small examples do not establish a universal winner, and sorting adds preparation work.

A different response can also meet the criteria. Compare the evidence and reasoning, rather than copying the wording.