You aren’t long into a computer programming course before you find yourself teaching or learning how to sort the contents of a list. Any computer science teacher will do the standards…
- sort an unordered collection of numbers in ascending or descending order
- sort a class list alphabetically
- sort groups of containers based on their capacity
While a quick read makes it sound like these are entirely different things and certainly they are to the eyes of a student learning to sort, they really aren’t. Computer wise, they all rely on being in some sort of order. Numbers or letters wouldn’t be terribly useful if they ultimately couldn’t be put in order.
The whole concept of sorting can be pretty academic or can actually be fun, particularly if you involve some activity or visualization to go with it. I’ve mentioned before how I actually have students “discover” an algorithm with 10 cards with the digits 0-9 on them, 10 people, and 11 chairs. The only rule is that only one person is allowed to stand up at a time.
The longer students stay in computer science, the more different sorting algorithms they learn. Over the years, I’ve taught many but truth be told, if I have to write a sort, the Bubble Sort and Selection Sort are the only ones that I have committed to memory. It’s actually one of those things that are easily found by any credible search engine.
Going back to visualizations, this a very interesting display.
If you like moving things to clarify concepts, you’ll love this.
You’ll see a number of play buttons on the page and can play the animation by sort, by data type, or hey, all at once. Beyond the concept of learning how a sort works, knowing a number of different algorithms, the data, and the efficiency all become part of the learning package.
You’ve got to love something that makes a programming concept fun to visualize.