Throwback Thursday: My First Sorting Algorithm
I just rediscovered some code I wrote for the University of Minnesota's "Structure of Computer Programming I", a course I took three years ago. CSCI 1901 focused mostly on learning Scheme with everyone's favorite Scheme textbook, the venerable SICP from MIT.
To get better at writing Scheme, I practiced by writing two versions of the bubble sort algorithm. One sorted a list of integers into increasing order, while another sorted a list of Cartesian tuples (x, y coordinates) into increasing distance from the origin. I think these sorts are even stable!
Building a bubblesort algorithm from scratch is one of the most rewarding things I've ever done as a programmer. To this day I'm still proud of these programs.
I even commented (one of) them. Enjoy:
(Released under the ISC License. Go crazy.)