Quick sort implementation ideas

  1. Figure out half the length of the array, take out the intermediate value, and the index value of the intermediate value
  2. Walk through the array, putting the item that is greater than the middle value in one array, and the item that is less than the middle value in the other array
  3. Recurse again for the larger and smaller arrays

Concrete code implementation

If (arr. Length <= 1) {return arr} var index = math.floor (arr. Length / 2) // Var midValue = arr.splice(index, 1)[0] let left = [], If (item < midValue) {left.push(item)} else {if (item < midValue) {left.push(item)} else { right.push(item) } }) return quickSort(left).concat([midValue], QuickSort (right)) // Recursively loop left and right again until arr.length <= 1, jump out, calculate the result}