Ternary QuickSort