swap on end of pivot

This commit is contained in:
Baipyrus 2024-05-21 20:02:06 +02:00
parent 8068c002b7
commit bdf3e3437a

View File

@ -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],