Quick Sort
Add your data below
Invalid user input
Try data with more numbers
Input Data
Sorted Data
Quick Sort source code
def sort(arr: List[int]) -> List[int]: if len(arr) < 2: return arr else: pivot = len(arr) - 1 pivot_val = arr[pivot] right, left, equal = [], [], 1 for i in range(pivot): if arr[i] > pivot_val: right.append(arr[i]) elif arr[i] < pivot_val: left.append(arr[i]) else: equal += 1 right, left = sort(right), sort(left) for i, _ in enumerate(arr): if len(left) != 0: arr[i] = left.pop(0) elif equal != 0: arr[i] = pivot_val equal -= 1 else: arr[i] = right.pop(0) return arr