题解 | #快速排序#
快速排序
https://www.nowcoder.com/practice/38da660199d0400580ac3905c05f5bd6
// 这个提示不太友好
const _quickSort = array => {
function temp(arr, i, j) {
let temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
}
for (let i = 0; i < array.length; i++) {
for (let j = 0; j < array.length; j++) {
if (array[i] < array[j]) {
temp(array, i, j)
}
}
}
return array
}