swap on end of pivot
This commit is contained in:
parent
8068c002b7
commit
bdf3e3437a
|
@ -59,6 +59,13 @@
|
|||
step() {
|
||||
if (this.start >= this.end - 1 || this.start < 0) return new Response(true, null, null, null);
|
||||
|
||||
if (this.compr >= this.end - 1) {
|
||||
[this.array[this.index], this.array[this.end - 1]] = [
|
||||
this.array[this.end - 1],
|
||||
this.array[this.index]
|
||||
];
|
||||
}
|
||||
|
||||
if (this.array[this.compr] <= this.pivot) {
|
||||
[this.array[this.index], this.array[this.compr]] = [
|
||||
this.array[this.compr],
|
||||
|
|
Loading…
Reference in New Issue
Block a user