# Merge sort

In this lesson, we will explore the final sorting algorithm in this unit: merge sort. We will start by considering how we might go about combining two groups of sorted items into one sorted group before being taken through the steps of one merge of a merge sort.

#### Unit quizzes are being retired in August 2023

Why we're removing unit quizzes from the website >
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!

Q1.'A more efficient version of bubble sort uses a variable to flag when a swap was made during a single pass'

1/9

Q2.'The insertion sort algorithm copies the value to be inserted in a variable at the end of each pass'

2/9

Q3.'During a pass of an insertion sort, elements in the sorted part of the list are copied into the next position, to make space for the value to be inserted'

3/9

Q4.Two improvements to the bubble sort algorithm are reducing the number of comparisons after each pass, and stopping once no swaps are made during a single pass.

4/9

Q5."Bubble sort compares items next to each other in the list and swaps them if they are in the wrong order."

5/9

Q6."Insertion sort compares an item from the unsorted sublist with the items in the sorted sublist and places it in the correct position."

6/9

Q7."Bubble sort is good at sorting large collections of unordered data."

7/9

Q8."Bubble sort can be really fast at sorting data that is nearly in order."

8/9

Q9."Insertion sort is usually slower to execute than bubble sort on large, unordered data sets."

9/9

#### Unit quizzes are being retired in August 2023

Why we're removing unit quizzes from the website >
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!

Q1.'A more efficient version of bubble sort uses a variable to flag when a swap was made during a single pass'

1/9

Q2.'The insertion sort algorithm copies the value to be inserted in a variable at the end of each pass'

2/9

Q3.'During a pass of an insertion sort, elements in the sorted part of the list are copied into the next position, to make space for the value to be inserted'

3/9

Q4.Two improvements to the bubble sort algorithm are reducing the number of comparisons after each pass, and stopping once no swaps are made during a single pass.

4/9

Q5."Bubble sort compares items next to each other in the list and swaps them if they are in the wrong order."

5/9

Q6."Insertion sort compares an item from the unsorted sublist with the items in the sorted sublist and places it in the correct position."

6/9

Q7."Bubble sort is good at sorting large collections of unordered data."

7/9

Q8."Bubble sort can be really fast at sorting data that is nearly in order."

8/9

Q9."Insertion sort is usually slower to execute than bubble sort on large, unordered data sets."

9/9

# 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.

#### Unit quizzes are being retired in August 2023

Why we're removing unit quizzes from the website >
Quiz:

# Merge Sort

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

Q1.'The merge sort algorithm has two parts: splitting items and merging items'

1/8

Q2.The first part of a merge sort it to repeatedly split a list in half until all the elements are in a list by themselves.

2/8

Q3.Each stage of the merge sort algorithm can be shown in two parts: splitting the items and merging pairs of lists.

3/8

Q4.The merge sort algorithm is less complex to implement than bubble sort.

4/8

Q5.The advantage to merge sort is that it requires more memory, often due to the new lists that need to be created.

5/8

Q6."Executing a merge sort takes up extra space in memory, as new lists are made each time a list is split or two lists are combined."

6/8

Q7."A merge sort algorithm is usually slower to execute but more easier to write than bubble sort."

7/8

Q8."Merge sort is an efficient divide and conquer algorithm that can perform well in real-world use."

8/8

#### Unit quizzes are being retired in August 2023

Why we're removing unit quizzes from the website >
Quiz:

# Merge Sort

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

Q1.'The merge sort algorithm has two parts: splitting items and merging items'

1/8

Q2.The first part of a merge sort it to repeatedly split a list in half until all the elements are in a list by themselves.

2/8

Q3.Each stage of the merge sort algorithm can be shown in two parts: splitting the items and merging pairs of lists.

3/8

Q4.The merge sort algorithm is less complex to implement than bubble sort.

4/8

Q5.The advantage to merge sort is that it requires more memory, often due to the new lists that need to be created.

5/8

Q6."Executing a merge sort takes up extra space in memory, as new lists are made each time a list is split or two lists are combined."

6/8

Q7."A merge sort algorithm is usually slower to execute but more easier to write than bubble sort."

7/8

Q8."Merge sort is an efficient divide and conquer algorithm that can perform well in real-world use."

8/8

# Lesson summary: Merge sort

## Time to move!

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

For 5 mins...

Move around:
Walk

On the spot:
Chair yoga