ThreeWayQuickSort
Three-Way Quick Sort.
Optimized Quick Sort that handles arrays with many duplicate values efficiently by partitioning into three sections:
Less than pivot
Equal to pivot
Greater than pivot
Time complexity:
Best: O(n log n)
Average: O(n log n)
Worst: O(n²)
Space complexity:
O(log n) recursion stack