Hybrid sorting algorithm that's stable, O(n) best case, O(nlogn) worst case, and O(1) memory