Beware of bugs in the above code; I have only proved it correct, not tried it.
Whether you think about it or not, your computer spends much of its time sorting “things”. And there are numerous algorithms for doing this, each with varying measures of complexity and efficiency (for the interested reader, you can discover the wonders of sorting and searching in Volume 3 of Knuth‘s bible: The Art of Computer Programming).
Sorting algorithms also provide a gentle introduction to a variety of core computer science concepts, especially data structures and complexity. And what better way to learn some of the common sorting algorithms than through the medium of (Hungarian folk) dance!
For example, quicksort:
Or if you prefer a rather more mundane visualisation of quicksort:
(see more videos at the Algo-Rythmics website)