I made a video of how the algorithm works:
http://youtu.be/NjcSyD7p660
To make it I needed a C++ version with iterators, which I though would be faster. But it is still about 20% slower than stable_sort for the default random input test. It probably also stays the same for other inputs.