(array, left, right)
| 1 | // write the quickSort algorithm |
| 2 | |
| 3 | const swap = (array, left, right) => { |
| 4 | const temp1 = array[left]; |
| 5 | const temp2 = array[right]; |
| 6 | array[left] = temp2; |
| 7 | array[right] = temp1; |
| 8 | }; |
| 9 | |
| 10 | const partition = (array, left, right) => { |
| 11 | const pivotIndex = Math.floor((left + right) / 2); |