mirror of
https://github.com/github/codeql.git
synced 2025-12-30 07:36:34 +01:00
12 lines
279 B
JavaScript
12 lines
279 B
JavaScript
function qsort(a) {
|
|
if (a.length == 0) return [];
|
|
|
|
var left = [], right = [], pivot = a[0];
|
|
|
|
for (var i = 1; i < a.length; i++) {
|
|
debugger;
|
|
a[i] < pivot ? left.push(a[i]) : right.push(a[i]);
|
|
}
|
|
|
|
return qsort(left).concat(pivot, qsort(right));
|
|
} |