New
New
Year 10
AQA

Comparing searching algorithms

I can compare and contrast linear and binary search and trace the code for both searching algorithms.

New
New
Year 10
AQA

Comparing searching algorithms

I can compare and contrast linear and binary search and trace the code for both searching algorithms.

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

These resources were created for remote use during the pandemic and are not designed for classroom teaching.

Lesson details

Key learning points

  1. The searching algorithm you use will depend on the data and context you are using.
  2. Coding a binary search is more complex than a linear search.
  3. Tracing code for searching algorithms by completing a trace table can help you check how efficient the algorithm is.

Keywords

  • Algorithm - a set of step-by-step instructions to solve a problem

  • Trace table - a tool used to track the values of variables and the flow of execution in an algorithm or program, step by step

Common misconception

A linear search algorithm and binary search algorithm are equally complex to write.

Binary search algorithms are more complex to write due to the different paths that the algorithm can take rather than stepping through the search data in order.


To help you plan your year 10 computer science lesson on: Comparing searching algorithms, download all teaching resources for free and adapt to suit your pupils' needs...

Pupils might benefit from coding the algorithms themseleves based on the steps modelled. Simply reading the code is often not enough to understand the principle of its operation.
Teacher tip

Equipment

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

6 Questions

Q1.
What is the name of the algorithm that checks each item in a list one by one until the desired item is found?
Correct Answer: linear search
Q2.
Which of these is true about linear search?
It can only be used on sorted lists.
It skips items that are not in order.
It requires the list to be alphabetical.
Correct answer: It works on both sorted and unsorted lists.
Q3.
What does binary search do with the data set at each step?
It compares all items in the list.
It skips every other item in the list.
It sorts the data again.
Correct answer: It discards half of the remaining data.
Q4.
What must be true about a list for binary search to work?
The list must contain only numbers.
The list must be short.
The list must have duplicates.
Correct answer: The list must be sorted.
Q5.
Which of these is an example of a sorted list?
Correct answer: a list of names in alphabetical order
a random list of numbers
a collection of photos
a timetable with no sequence
Q6.
How many comparisons does binary search make in the best-case scenario?
Correct Answer: 1, one

6 Questions

Q1.
Arrange the steps of a linear search in the correct order:
1 - Compare the first item in the list to the target value.
2 - Move to the next item in the list.
3 - Repeat until the target value is found or the list ends.
4 - Stop searching when the target value is found.
Q2.
Arrange the steps of binary search:
1 - Sort the data set.
2 - Set the range to the entire list.
3 - Find the midpoint of the range.
4 - Compare the midpoint with the target item.
5 - Adjust the range based on the comparison.
6 - Stop when the midpoint matches the target.
Q3.
Match the situation to the concept:
Correct Answer:works on unordered data,linear search

linear search

Correct Answer:requires sorted data,binary search

binary search

Correct Answer:tracks variable values,trace table

trace table

Correct Answer:step-by-step instructions,algorithm

algorithm

Q4.
What is a trace table used for?
Correct answer: to track the values of variables during execution
to sort data in ascending order
to compare two algorithms
to find errors in a program
Q5.
Which searching algorithm is more complex to write?
linear search
Correct answer: binary search
both are equally complex
neither requires coding
Q6.
Which of these is true about linear search?
It is faster for large data sets.
It requires sorted data.
It skips items in the list.
Correct answer: It works on ordered and unordered lists.