Lesson details

Key learning points

  1. In this lesson, we will be introduced to binary search: the second searching algorithm we need to know about. We will go over the steps of carrying out a binary search and perform a binary search with playing cards and with a sample of data.

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.
What card would you need to search for, for the best-case scenario to occur?
10
Correct answer: 6
7
8
9
Q2.
What card would you need to search for, for the worst-case scenario to occur?
10
6
7
Correct answer: 8
9
Q3.
How many comparisons would it take to work out that a card wasn’t in the set of cards?
10
6
7
Correct answer: 8
9
Q4.
When carrying out the linear search, does the data need to be ordered?
Correct answer: No
Yes

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

Lesson appears in

UnitComputing / Algorithms

Computing