MCPcopy Create free account
hub / github.com/betomoedano/JavaScript-Coding-Interview-Questions / quickSort

Function quickSort

sorting/quick-sort.js:5–8  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

3// space O(log n) because we need to use recursion and if we apply quick sort first on the smaller array that
4// way we know that at most we will store log n calls on the call stack
5function quickSort(array) {
6 quickSortHelper(array, 0, array.length - 1);
7 return array;
8}
9
10function quickSortHelper(array, startIdx, endIdx) {
11 if (startIdx >= endIdx) return;

Callers 1

quick-sort.jsFile · 0.85

Calls 1

quickSortHelperFunction · 0.85

Tested by

no test coverage detected