Overview

Published

2023-08-06

This week we continue our tour of sorting algorithms. We introduce two new \mathcal{O}(n^2) algorithms—selection and insertion sort, and we introduce our first $(n n) sorting algorithm—merge sort. Merge sort represents a different class of algorithms, called “divide and conquer” algorithms. These algorithms solve problems by breaking a problem down into smaller problem instances, solving the smaller problems, and then—by various means—combining the results of smaller problems to produce a complete solution. These algorithms work by recursion.

While we introduce the divide and conquer approach in the context of sorting, you should be aware that it is a technique with applicability to numerous problems in a wide variety of domains.

Learning Objectives

By the end of this module, you will be able to:

  • Understand and implement selection sort, insertion sort, and merge sort algorithms.
  • Understand the use cases and limitations for each of these sorting algorithms.
  • Understand the complexity of each of these sorting algorithms.

To achieve this module’s objectives, please watch the introductory video (above), and complete the following:

Read: Essential Algorithms, O(N log N) Algorithms: pp. 138-155 (Chapter 6). OPTIONAL: Chapter 9: pp. 185-193, for more on recursion.

Read / view the following content and complete any comprehension checks:

  • Selection sort
  • Insertion sort
  • Merge sort

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

No generative AI was used in producing this material. This was written the old-fashioned way.

All materials copyright © 2020–2023, The University of Vermont. All rights reserved.