# Comparing searching algorithms

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

This quiz includes images that don't have any alt text - please contact your teacher who should be able to help you with an audio description.

Quiz:

# Intro quiz - Recap from previous lesson

Before we start this lesson, let’s see what you can remember from this topic. Here’s a quick quiz!

## Question 4

Q1.When carrying out the binary search, does the data need to be ordered?

1/4

Q2.With each comparison, the binary search algorithm eliminates how of the data.

2/4

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

3/4

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?

4/4

This quiz includes images that don't have any alt text - please contact your teacher who should be able to help you with an audio description.

Quiz:

# Intro quiz - Recap from previous lesson

Before we start this lesson, let’s see what you can remember from this topic. Here’s a quick quiz!

## Question 4

Q1.When carrying out the binary search, does the data need to be ordered?

1/4

Q2.With each comparison, the binary search algorithm eliminates how of the data.

2/4

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

3/4

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?

4/4

# Video

Click on the play button to start the video. If your teacher asks you to pause the video and look at the worksheet you should:

• Click "Close Video"
• Click "Next" to view the activity

Your video will re-appear on the next page, and will stay paused in the right place.

# Worksheet

These slides will take you through some tasks for the lesson. If you need to re-play the video, click the ‘Resume Video’ icon. If you are asked to add answers to the slides, first download or print out the worksheet. Once you have finished all the tasks, click ‘Next’ below.

This quiz includes images that don't have any alt text - please contact your teacher who should be able to help you with an audio description.

Quiz:

# Comparing Searching Algorithms

This quiz is to assess your learning from this lesson. Read the description below and select which term it is referring to:

## Question 4

Q1.The sequence of items in the list can either be ordered or unordered.

1/4

Q2.If you double the number of items in the list, you will need at most one more comparison.

2/4

Q3.The algorithm is simpler to write.

3/4

Q4.What does the initial value of -1 indicate?

4/4

This quiz includes images that don't have any alt text - please contact your teacher who should be able to help you with an audio description.

Quiz:

# Comparing Searching Algorithms

This quiz is to assess your learning from this lesson. Read the description below and select which term it is referring to:

## Question 4

Q1.The sequence of items in the list can either be ordered or unordered.

1/4

Q2.If you double the number of items in the list, you will need at most one more comparison.

2/4

Q3.The algorithm is simpler to write.

3/4

Q4.What does the initial value of -1 indicate?

4/4

# Lesson summary: Comparing searching algorithms

### It looks like you have not completed one of the quizzes.

To share your results with your teacher please complete one of the quizzes.

### Time to move!

Did you know that exercise helps your concentration and ability to learn?

For 5 mins...

Move around:
Jog

On the spot:
Dance

### Take part in The Big Ask.

The Children's Commissioner for England wants to know what matters to young people.

Share your views and have your voice heard.

The next lesson in Algorithms is "Bubble sort"