function quickSort(array) {
if (array.length < 2) {
return array
} else {
const pivot = array[0]
const less = array.filter(i => i < pivot)
const grater = array.filter(i => i > pivot)
return [...quickSort(less), pivot, ...quickSort(grater)]
}
}
网友评论