I would break it into an interface that abstracts the sorting algorithm so that the sorting logic is decoupled from comparison logic or from the visuals. This would make it so that you can use different sorting algorithms and compare between them to see which one seems the most magical.
Magical might mean something different between us, so I don't want to assume and just give you an algo.
Holy shit, that's in log scale.