Lesson details

Key learning points

  1. In this lesson, we will analyse and evaluate code for bubble sort and insertion sort in Python, as well as comparing different implementations of the bubble sort 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...

7 Questions

Q1.
"The insertion sort algorithm works by grouping the items in a list into two parts: a sorted sublist and an unsorted sublist."
False
Correct answer: True
Q2.
"With each pass through the list, an item from the unsorted sublist is compared to items in the sorted sublist until it is inserted into the correct position."
False
Correct answer: True
Q3.
"If the item at the current position is greater than value, copy it into the next item and move on to the previous item in the list"
False
Correct answer: True
Q4.
"Insertion sort compares an item from the unsorted sublist with the items in the sorted sublist and places it in the correct position."
False
Correct answer: True
Q5.
"Insertion sort is usually slower to execute than bubble sort on large, unordered data sets."
Correct answer: False
True
Q6.
"Insertion sort is usually slower to execute than bubble sort on large, unordered data sets."
Correct answer: False
True
Q7.
"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."
False
Correct answer: True

9 Questions

Q1.
'A more efficient version of bubble sort uses a variable to flag when a swap was made during a single pass'
False
Correct answer: True
Q2.
'The insertion sort algorithm copies the value to be inserted in a variable at the end of each pass'
Correct answer: False
True
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'
False
Correct answer: True
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.
False
Correct answer: True
Q5.
"Bubble sort compares items next to each other in the list and swaps them if they are in the wrong order."
False
Correct answer: True
Q6.
"Insertion sort compares an item from the unsorted sublist with the items in the sorted sublist and places it in the correct position."
False
Correct answer: True
Q7.
"Bubble sort is good at sorting large collections of unordered data."
Correct answer: False
True
Q8.
"Bubble sort can be really fast at sorting data that is nearly in order."
False
Correct answer: True
Q9.
"Insertion sort is usually slower to execute than bubble sort on large, unordered data sets."
Correct answer: False
True

Lesson appears in

UnitComputing / Algorithms

Computing