mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
Merge c92f9839ed
into ca3d16dcce
This commit is contained in:
commit
86783253d5
@ -19,12 +19,12 @@ export default class QuickSort extends Sort {
|
||||
const rightArray = [];
|
||||
|
||||
// Take the first element of array as a pivot.
|
||||
const pivotElement = array.shift();
|
||||
const pivotElement = array.pop();
|
||||
const centerArray = [pivotElement];
|
||||
|
||||
// Split all array elements between left, center and right arrays.
|
||||
while (array.length) {
|
||||
const currentElement = array.shift();
|
||||
const currentElement = array.pop();
|
||||
|
||||
// Call visiting callback.
|
||||
this.callbacks.visitingCallback(currentElement);
|
||||
|
Loading…
Reference in New Issue
Block a user