Introduction to sorting

Published

2023-08-05

Sorting is a common operation, and there are dozens of algorithms we can use to sort a vector or array. Of course, sorting requires that elements in the underlying data structure are comparable.

Bubble sort is like the “Hello World” of sorting algorithms. It’s never used in practice (we’ll see why soon), but it is one of the easiest sorting algorithms to understand. Accordingly, we’ll start with bubble sort. Here’s a coding session where we implement bubble sort, and progressively improve on the implementation.

Resources

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.