Skip to main content

Distribution Sorts

Overview

This lesson covers two sorting algorithms that use the distribution sort method: bucket sort and radix sort. This is different than the other sorting algorithms we've met so far, which use the comparison sorting method.

There are two components to this lesson:

  1. myGA module: Distribution Sorting Algorithms
    • If the above link does not take you to the correct module, you can find the lesson in your myGA dashboard.
  2. In-Class Exercise: Implementing Bucket 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:

  • Explain how bucket sort and radix sort work.
  • Identify scenarios in which bucket sort and radix sort should be used.
  • Describe the time complexity of bucket sort.
  • Implement bucket sort.

Prerequisites

  • Big O Notation
  • Intro to Sorting Algorithms
  • Basic Sorting Algorithms

Duration

1.5 hours total:

  • 0.5 hour myGA
  • 1 hour in class

Additional Resources