Surprise Me!

Merge Sort

2010-10-05 3 0 Vimeo

Code and project comments available at http://github.com/JoshCheek/Play/tree/master/sort-viewer/ This is my personal favourite, I had to think about it for a while to figure out how to display it (thanks to Kevin Griffin for analyzing it on the chalkboard with me). Since it doesn't sort in place, I have it represent the two sorted subarrays as queues in an unsorted right portion, with the merged portion to the left. Conceptually, I think about it as sorting both halves simultaneously, as shown here, but in reality, it does not. This, however, is much more interesting to watch. To see the non simultaneous version, follow the link to the code, and run it with mergesort.old.rb