Quick Sort

Languages

Implement a function that performs a recursive, in-place quick sort. The function should take in an array of integers. The output should be an array with the input sorted in ascending order.

The input array may be empty and may contain negative or duplicate integers.

Examples

quickSort([9, 3, 6, 2, 1, 11]); // [1, 2, 3, 6, 9, 11]
quickSort([12, 16, 14, 1, 2, 3]); // [1, 2, 3, 12, 14, 16]

Hints

New

Loading editor

    Quick Sort | Algorithms Interview Questions with Solutions