Basic Sorts

Overview

This lesson covers two foundational sorting algorithms: bubble sort and insertion sort.

There are three components to this lesson:

  1. myGA module: Basic Sorting Algorithms
  2. In-Class Exercise: Implementing Bubble Sort
  3. In-Class Exercise: Implementing Insertion Sort

Note: The myGA module contains a link to an exercise in CodePen. The code in CodePen is the exact same as the code for the in-class exercises. Try out the exercise in CodePen and see how far you can get with it. Leave off where you get stuck and we'll review the solution in class.

Learning Objectives

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

  • Describe the time and space complexities of bubble sort and insertion sort.
  • Implement bubble sort and insertion sort.

Prerequisites

  • Big O Notation
  • Introduction to Sorting

Duration

Roughly 2.5 hours total:

  • 0.5 hour myGA
  • 2 hours in class

Additional Resources