Insertion Sort Algorithm Worksheet
This worksheet focuses on understanding and applying the Insertion Sort algorithm, a fundamental sorting technique.
Includes
Standards
Insertion Sort Algorithm Worksheet
Name:
Date:
Score:
Read each question carefully and provide your answers in the space provided. Show your work for any sorting steps.
Insertion Sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. However, for small lists, it is quite efficient.
How Insertion Sort Works:
1. Iterate from the second element (key) to the last element of the array. 2. Compare the key element with its predecessor. 3. If the key element is smaller than its predecessor, compare it with the elements before. Move the greater elements one position up to make space for the swapped element.
1. In your own words, explain the basic idea behind the Insertion Sort algorithm.
2. What type of lists would Insertion Sort be most efficient for?
3. Insertion Sort builds the final sorted array one at a time.
4. When comparing the key element with its predecessor, if the key is smaller, you need to the greater elements to make space.
5. Which of the following is generally considered less efficient than Insertion Sort for very large datasets?
Quicksort
Heapsort
Merge Sort
None of the above
6. What is the primary characteristic of Insertion Sort that makes it efficient for small lists?
It uses recursion.
It has a low overhead.
It divides the list into sub-lists.
It uses a pivot element.
7. Sort the following list of numbers using the Insertion Sort algorithm. Show each step of the sorting process.
[5, 2, 4, 6, 1, 3]
8. Insertion Sort is an in-place sorting algorithm.
True
False