Insertion Sort

insertion-sortMoving along in the Algorithms fourth edition book by Robert Sedgewick and Kevin Wayne, I experimented with the Insertion sort algorithm. Visit the web site to view an animation of the algorithm. As you can see, it resembles a person arranging playing cards for a game of bridge.

The way the authors described the API to the sorting algorithms allow this one to be quite elegant and compact.
Continue reading “Insertion Sort”