Year 10
Year 10

Comparing searching algorithms

Lesson details

Key learning points

  1. In this lesson, we will compare the features of linear search and binary search and the suitability of each algorithm in different contexts. We will also interpret the code of both algorithms in Python, as well as analysing the efficiency of two implementations of the linear search algorithm.

Licence

This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.

Loading...

4 Questions

Q1.
When carrying out the binary search, does the data need to be ordered?
No
Correct answer: Yes
Q2.
With each comparison, the binary search algorithm eliminates how of the data.
All
Correct answer: Half
Quater
Q3.
If the midpoint item is less than than the search item, do you change the range to focus on the items after or before the midpoint
Correct answer: After
Before
Q4.
When finding the item in the middle of the range (the midpoint item). If there is an even number of items, which item do you select?
Correct answer: The middle-left item
The middle-right item

4 Questions

Q1.
The sequence of items in the list can either be ordered or unordered.
Binary Search
Correct answer: Linear Search
Q2.
If you double the number of items in the list, you will need at most one more comparison.
Correct answer: Binary Search
Linear Search
Q3.
The algorithm is simpler to write.
Binary Search
Correct answer: Linear Search
Q4.
What does the initial value of -1 indicate?
The item has been found.
Correct answer: The item has not been found.