New
New
Year 10
OCR

Binary search

I can identify when a binary search can be used and perform its steps on a set of data.

New
New
Year 10
OCR

Binary search

I can identify when a binary search can be used and perform its steps on a set of data.

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. Binary search is an algorithm which can be used to search for an item in a sorted data set.
  2. It discards half of the remaining data with each comparison and repeats the process until the item is found.
  3. On average, a binary search can locate an item in a list in less time than a linear search.
  4. If the data you have is unordered, you must either use a linear search algorithm or sort the data first.

Keywords

  • Binary search - an algorithm to search for an item in a sorted data set — it discards half of the remaining data with each comparison and repeats the process until the item is found or until the data set is exhausted

  • Ordered list - a list of items where the values are in either ascending or descending order

Common misconception

A binary search can be performed on any data.

A binary search can only be performed on an ordered list as it finds the expected position of the search term based on a selected mid-point in the data.


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

Try a binary search on an unordered list to demonstrate why the algorithm does not work with unordered data.
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 main difference between an ordered and unordered list?
Correct answer: Ordered lists have items in a specific sequence; unordered lists do not.
Ordered lists are longer.
Ordered lists contain only numbers.
Ordered lists cannot be changed.
Q2.
Which of these is an advantage of an ordered list?
Correct answer: It is easier to search through.
It contains fewer items.
It cannot be changed.
It is always alphabetical.
Q3.
When searching for a word in a dictionary, what makes it possible to find the word?
The dictionary contains lots of words.
The dictionary has pictures.
The words are in random order.
Correct answer: The words are in alphabetical order.
Q4.
Why might searching an unordered list take longer than an ordered list?
Items are too similar.
Items cannot be searched.
Correct answer: Items are not arranged in any logical order.
Items are written in different colours.
Q5.
Which of these is an example of an ordered list?
a random list of items on a shopping list
Correct answer: a timetable showing class times
a collection of photos
a list of random words
Q6.
What is the name of the algorithm that checks each item in a list one at a time to find a specific item?
Correct Answer: linear search

6 Questions

Q1.
What is the name of the algorithm that searches a sorted list by repeatedly halving the data set?
Correct Answer: binary search
Q2.
Match the term to its definition:
Correct Answer:binary search,searches sorted data by halving each step

searches sorted data by halving each step

Correct Answer:ordered list,items arranged in ascending or descending order

items arranged in ascending or descending order

Correct Answer:best-case scenario,fewest steps needed to find an item

fewest steps needed to find an item

Correct Answer:worst-case scenario,most steps needed or item not found

most steps needed or item not found

Q3.
What type of list is required for a binary search to work?
an unordered list
a list with only numbers
Correct answer: an ordered list
a list with only strings
Q4.
What happens if the data is unordered and you want to perform a binary search?
You can perform the binary search as usual.
Correct answer: You must sort the data first.
You can only search for strings.
A binary search cannot be performed on unordered data, even if sorted.
Q5.
Arrange the steps of a binary search algorithm in the correct order:
1 - Set the range to the entire list.
2 - Find the midpoint item in the range.
3 - Compare the midpoint to the search item.
4 - If less, focus on items after the midpoint.
5 - If greater, focus on items before the midpoint.
6 - If equal, stop searching.
Q6.
Why is binary search typically faster than linear search for large data sets?
It checks every item in the list.
It skips items randomly.
Correct answer: It eliminates half of the remaining data with each comparison.
It works only with ordered lists.