We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fe7df3 commit 769c213Copy full SHA for 769c213
src/algorithms/sorting/quick-sort/QuickSort.js
@@ -19,12 +19,12 @@ export default class QuickSort extends Sort {
19
const rightArray = [];
20
21
// Take the first element of array as a pivot.
22
- const pivotElement = array.shift();
+ const pivotElement = array.pop();
23
const centerArray = [pivotElement];
24
25
// Split all array elements between left, center and right arrays.
26
while (array.length) {
27
- const currentElement = array.shift();
+ const currentElement = array.pop();
28
29
// Call visiting callback.
30
this.callbacks.visitingCallback(currentElement);
0 commit comments