Overview

Published

2023-08-06

This week, we continue our tour of sorting algorithms with quicksort, bucket sort, radix sort, and heap sort.

Quicksort is another “divide and conquer” algorithm, invented as part of a wager by Tony Hoare and his employer! Tony said he could produce a faster algorithm than the one they were using. His boss said “No, you can’t.” The rest is history!

Heap sort makes use of the binary heap data structure we saw previously. We load the items we wish to sort into a binary heap, and then remove the items in sorted order—the binary heap does the work for us.

Bucket sort and radix sort are closely-related, and have sub-\mathcal{O}(n \log n) complexity. These sorting algorithms have roots dating back to the lat 19th century, when a similar algorithm was used for sorting and tabluating results of the 1890 US Census!

Learning Objectives

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

  • Understand and implement quicksort, radix sort, and heap sort algorithms.
  • Understand the use cases and limitations for each of these sorting algorithms.
  • Understand the complexity of each of these sorting algorithms.
  • Implement these algorithms in C++

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

Read: Essential Algorithms, Chapter 6:

  • O(N log N) Algorithms: pp. 138-155
  • Sub O(N log N) Algorithms and Summary, pp. 156-160

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

  • Quicksort
  • Radix Sort / bucket Sort
  • Heap 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.