Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0984

Search a list with linear search

Check items in order until a target is found or the list ends.

Section 7 · Algorithm design and problem-solving

Cambridge IGCSE Computer Science 0984 · Algorithm design and problem-solving · 2026–2028 Version 4 · 0984 (9–1) · 7
Exam scope and assessment notes

This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4. It covers subject content Topic 7 only. The separately published 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.

Before you begin

  • No programming language is required. Be comfortable with place value and multiplication; each lesson introduces the computer-science notation it uses.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

Which item does a linear search normally compare first?

What you will learn

  • Describe linear search
  • Report found and not-found outcomes
  • Trace comparisons in sequence

Linear search checks each item in turn

A linear search starts at the first item and compares it with the target. If it matches, the search can report the position; otherwise it moves to the next item.

Apply and check the rule

If every item has been checked without a match, report NotFound. The list does not need to be sorted, but each preceding item may need to be checked before the target is found.

Pause and explain

In [4, 11, 7], how many comparisons are needed to find 7?

Put the idea to work

Worked example

Search [12, 5, 19, 8] for 19. How many comparisons are made?

Show the worked solution
  1. Compare 12 with 19: no match.
  2. Compare 5 with 19: no match.
  3. Compare 19 with 19: match on comparison three.

Answer The target is at position 3 in one-based counting; three comparisons are made.

Try a topic test

Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.

Test this topic →

From guided practice to a new situation

Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.

1 · Guided

Search [21, 17, 32, 9] for 17. State the comparison sequence and result.

Give me a hint

Stop at the first matching item.

Compare my reasoning
  1. Compare with 21: no.
  2. Compare with 17: match.
  3. Report the second item using one-based positions.

Comparisons: 21, 17; found at position 2.

Look for these in your work

  • Order
  • Stop at match
  • Position
2 · Independent

Search [3, 8, 2] for 5. How many comparisons occur and what should be reported?

Give me a hint

Check every item because no match appears early.

Compare my reasoning
  1. Compare 3, 8 and 2 with 5.
  2. No comparison matches.
  3. The list ends, so report not found.

Three comparisons; NotFound.

Look for these in your work

  • All items checked
  • Comparison count
  • Outcome
3 · Transfer

A programmer returns the position of the last checked item even when the target is absent. Explain the error and a safer design.

Give me a hint

The final position is not evidence of a match.

Compare my reasoning
  1. Track whether a comparison actually equals the target.
  2. Only return a position after a successful match.
  3. If the list ends with no match, return NotFound or a defined sentinel.

The algorithm confuses the last inspected position with a successful result. Set a found flag or use a defined NotFound value and report a position only after equality is confirmed.

Look for these in your work

  • Error identified
  • Match condition
  • Absent outcome

Common mistakes

  • Claiming a linear search must sort the list first
  • Returning a position after reaching the end without a match
Recall without your notes

What can you explain now?

What happens if a linear search reaches the end without a match?

Compare with the explanation

It reports that the target was not found

Every item has been checked, so there is no matching position.

After trying it yourself, choose your next review. This is your self-assessment.

Your review choice appears on Today. Sign in to sync it across devices.

Make it stick

How does linear search handle a found target and an absent target?

If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.

Keep learning Computer Science (9-1)

Course scope and assessment

165 original lessons map the listed objectives across all 10 main topics in the 2026–2028 Version 4 syllabus. Cambridge states that 0984 has the same subject content as 0478, with 9–1 grading. Three retained introductory lessons remain available but are not counted as syllabus-mapped teaching. The 2023–2025 syllabus remains unmapped. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. Practical programming in an executable browser workspace, full timed-paper practice and human subject-teacher review remain outstanding. Practice is self-checked and does not award an official Cambridge grade.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.