GRADE 9 · COMPUTING · UNIT 1 · LESSON 1.7
Computational thinking and programming
Searching algorithms
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S LOOK, THINK AND TRY
Searching algorithms
- Explain the prerequisite ordering for binary search
- Perform a binary search and record every midpoint
Match the search to the data order
Linear search checks candidates in sequence and can work on an unsorted list. Binary search relies on data ordered according to the comparison being used. When sorted records carry identities or associated data, keep those associations together. An index in the sorted list may differ from the original position.
Shrink an inclusive candidate range
For this workbook, low and high are included and mid = (low + high) // 2 chooses the lower middle index. Compare the target with that item. After a mismatch, move to mid + 1 or mid - 1 so the tested middle item is excluded. Stop when found or when low > high. Use zero-based indices and the stated duplicate policy.

Work through an original example
Search the original ascending list [3, 8, 15, 22, 31, 45, 60] for 45 using the lower-middle rule.
Initially low = 0 and high = 6, so mid = 3 and the middle value is 22. Since 45 is greater, set low = 4. Now mid = (4 + 6) // 2 = 5, where the value is 45. The target is found at sorted-list index 5 after examining two middle values.
Try it before the workbook
Using the same list and rule, at which index is 8 found?
Use the example to choose your first step. This short preparation question is separate from your workbook. Open the check clue when you are ready.
Explore the clues
Open one card at a time to review your thinking.
Remember the idea
Linear search checks candidates in sequence and can work on an unsorted list. Binary search relies on data ordered according to the comparison being used. When sorted records carry identities or associated data, keep those associations together. An index in the sorted list may differ from the original position.
Check your first try
1
The first middle value is 22 at index 3. Keep indices 0 through 2; their middle index is 1, containing 8.
Explain and check
- Match exact code outputs, binary widths and stated units. Explain your method.
- Check the question, rules, outputs and units. Explain why your method works.

Think it through with Paxa!
Trace the stated rules and distinguish predictions from actual observations.
Original computing practice files
Optional small offline examples and fictional datasets, created for PaxaKids. They are supplementary practice, not publisher downloads or complete implementations of every workbook project. The page does not execute these files. Inspect code with a grown-up before using it in an approved offline environment; do not use real personal data.
Our Unit 1 learning path
- Lesson 1.1: Pseudocode
- Lesson 1.2: Iteration
- Lesson 1.3: Creating algorithms
- Lesson 1.4: Loops in text-based programming
- Lesson 1.5: Programming with data
- Lesson 1.6: Comparing algorithms
- Lesson 1.7: Searching algorithms
- Lesson 1.8: Testing
- Lesson 1.9: Physical computing
- Lesson 1.10: Word guess
- Lesson 1.11: Flowchart - Pseudocode - Program code
- Lesson 1.12: Original Paxa project: Revision challenge app
- Lesson 1.13: Check your progress
- Lesson 1.14: Computational thinking and programming - unit check
For grown-ups: using this lesson
Discuss the idea and worked example, then try the workbook. Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses. Accept a sound alternative method.
Opening or checking a worksheet does not complete a lesson. Choose “Mark lesson finished” when ready. Optional account progress saves the selected grade, lesson position and completion across devices. Personal worksheet responses stay in this tab; save your own copy before leaving.
2. Fill in your workbook
Use the original diagrams and stated conventions. Choose, write or draw on the pages, or use the larger Answer List controls. Code examples here are for tracing; this page does not execute them or connect to hardware. Use fictional data and approved supervised tools for project work.
Opening your PDF…
Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.
You’ve completed the checked activities.
TAKE YOUR PRACTICE OFFLINE
3. Download the student worksheet
All 14 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.
Student worksheet only · PDF · 6.7 MiB · No answer key included
TRY FIRST, THEN CHECK TOGETHER
Download the student worksheet →4. Answers & guidance
Finished your try? Open the guide and compare one worksheet at a time. Your own words may be different and still explain the right idea.
Shown on this webpage only. There is no answer-key download, and this guide is left out when printing the page.
Show answers for all 14 worksheets
Worksheet 1
- Question 1: What is required by the ascending binary search in this workbook? Data sorted in ascending order using the same comparison rule
Worksheet 2
- Question 2: Which list is correctly sorted? 2, 5, 8, 12, 19, 24, 31, 40
- Question 3: What is the first index in the sorted list? 0
- Question 4: What is the final index in the sorted list? 7
Worksheet 3
- Question 5: For low 0 and high 7: midpoint 3
- Question 6: For low 4 and high 7: midpoint 5
- Question 7: Why exclude a midpoint after a non-matching comparison? It has already been checked and is not the target
Worksheet 4
- Question 8: What index is returned for target 31? 6
Worksheet 5
- Question 9: Target 5: first midpoint index 3
- Question 10: Target 5: second midpoint index 1
- Question 11: Target 5: returned index 1
- Question 12: Target 40: third midpoint index 6
- Question 13: Target 40: returned index 7
- Question 14: Target 40: number of inspected items 4
Worksheet 6
- Question 15: What is the final value of low? 4
- Question 16: What is the final value of high? 3
- Question 17: Which result represents not found in this contract? -1
Worksheet 7
- Question 18: How should -1 be handled before reading values[result]? Treat it as not found and skip the indexed access
Worksheet 8
- Question 19: What number is printed on the final line? -1
Worksheet 9
- Question 20: What not-found code does this invalid search return? -1
- Question 21: At which actual index is 5 stored in this unsorted list? 6
- Question 22: Why is the elimination unsafe? Ordering does not justify which half can contain the target
Worksheet 10
- Question 23: Target 31: how many fewer checks does binary use? 4
- Question 24: Absent 18: how many fewer checks does binary use? 5
- Question 25: Which conclusion fits this evidence? Binary uses fewer checks in some cases; linear wins for target 2
Worksheet 11
- Question 26: What index does the shown algorithm return for the repeated 5? 2
- Question 27: What result does it return for an empty list? -1
- Question 28: What extra requirement needs a modified algorithm? Return the first occurrence of a repeated value
Worksheet 12
- Question 29: Current midpoint index 7
- Question 30: Faulty low = mid: new low 7
- Question 31: Correct low = mid + 1: new low 8
- Question 32: What happens after the correct update? low > high, so the search ends as not found
- Question 33: Which additional cost matters for a single search on unsorted input? Sorting or choosing a suitable linear search
Worksheet 13
- Question 34: Show the sorted list and a trace for both searches. Record low, high, midpoint index, midpoint value and the next action at every step. Give the returned result and explain the not-found stopping condition. Label a paper trace or an actual run. Sorted values: [2, 5, 8, 12, 19, 24, 31, 40]. Target 31: (low 0, high 7, mid 3, value 12) keep right, then (4, 7, 5, 24) keep right, then (6, 7, 6, 31) found at index 6. Target 18: (0, 7, 3, 12) low becomes 4; (4, 7, 5, 24) high becomes 4; (4, 4, 4, 19) high becomes 3. Now low 4 exceeds high 3, so return -1 without another access. Each inspected midpoint is included, eliminated midpoint is excluded, and original identities are not confused with sorted positions. Accept an equivalent clear labelled trace using the stated lower-midpoint convention. Actual run evidence must be observed or Pending; a labelled paper trace is valid reasoning evidence. Grown-up review; discuss your evidence and reasoning.
Worksheet 14
- Question 35: Explain how the unsorted search can miss an existing 5. Compare linear and binary checks for target 2 in the sorted list. Give one reason to include sorting cost in a practical choice and state what a duplicate-match result does not guarantee. On unsorted [2, 31, 8, 12, 19, 24, 5, 40], first midpoint index 3 has value 12. Target 5 is smaller, so the algorithm discards indices 3 through 7, including the actual match at index 6. It later inspects 31 and 2 and returns -1; the ordering precondition was violated. On the sorted list, linear target 2 needs 1 item check, binary uses indices 3, 1, 0 and needs 3. Therefore binary is not best for every specific search. For one search, preparing unsorted input costs work and can change positions; linear search may avoid that preparation. A standard duplicate match need not be the first occurrence. Counts use inspected items, not every source-level comparison or elapsed time. Accept equivalent clear evidence-based explanations. Grown-up review; discuss your evidence and reasoning.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing Learner’s Book 9 — pages 128–131
Computing for your homeschool day
Explore Searching algorithms with this free Grade 9 Computing lesson. Read one idea together, try the fillable workbook and return to review at your own pace. Download the same student worksheet PDF for pencil-and-paper practice.
Fit learning around your family’s day. There is no timer and no sign-up is needed to use the lesson. An optional account saves your lesson position and completion across devices. Workbook responses and drawings stay in this tab; save a copy of your responses before leaving.
Understand your results
Closed answers are checked in your browser. Drawings and written explanations need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.
Choose Review Answers after trying the activity. The guide stays on the webpage; the worksheet download contains only the student pages.
For programme background, visit the Cambridge Lower Secondary Computing overview. PaxaKids provides independent original companion practice.
The original practice follows the source topic teaching.
The page references identify the reviewed actual supplied book teaching and related practice. Only the cited Learner’s Book teaching pages are listed here. No matching publisher Workbook 9 was supplied or cited. The original PaxaKids workbook is the student download; no textbook scan is published. Explanations, worked models and student workbooks here are original PaxaKids companion material.
The source topic number is preserved.
