Year 10
Lesson details
Key learning points
- 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
Q2.
With each comparison, the binary search algorithm eliminates how of the data.
All
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
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?
The middle-right item
4 Questions
Q1.
The sequence of items in the list can either be ordered or unordered.
Binary Search
Q2.
If you double the number of items in the list, you will need at most one more comparison.
Linear Search
Q3.
The algorithm is simpler to write.
Binary Search
Q4.
What does the initial value of -1 indicate?
The item has been found.