Skip to content

Commit ea1b85c

Browse files
committed
feat: inconsequential changes made
1 parent e23881d commit ea1b85c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/algorithms/controllers/msort_arr_nat.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export function run_msort() {
152152

153153
chunker.add('left', (vis, c_left) => {
154154
assignVarToA(vis, 'left', c_left, size);
155-
assignVarToA(vis, "size", size, size);
155+
// assignVarToA(vis, "size", size, size);
156156
}, [left]);
157157

158158
do {
@@ -321,9 +321,13 @@ export function run_msort() {
321321
chunker.add('CopyRest1', (vis, a, b, c_ap1, c_max1, c_left, c_right, c_mid, c_bp, c_rcount) => {
322322
// future color: should be runAColor & runBColor
323323
resetArrayA(vis, "nat", a, c_left, c_mid, c_right, c_rcount, runAColor, runCColor);
324-
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_nat');
324+
if (isMergeExpanded()) {
325+
vis.arrayB.set(b, 'msort_arr_nat');
326+
assignVarToB(vis, 'bp', c_bp, size);
327+
}
325328
assignVarToA(vis, 'ap1', c_ap1, size);
326329
assignVarToA(vis, 'max1', c_max1, size);
330+
327331
// to highlight the solrted elements of B array green / colorC
328332
for (let i = c_left; i < c_bp; i++) highlightB(vis, i, sortColor);
329333
}, [A, B, ap1, max1, left, right, mid, bp, runcount]);
@@ -334,15 +338,19 @@ export function run_msort() {
334338
A[i] = undefined;
335339
bp = bp + 1;
336340
}
337-
chunker.add('CopyRest2', (vis, a, b, c_ap2, c_max2, c_left, c_right, c_mid, c_rcount) => {
341+
chunker.add('CopyRest2', (vis, a, b, c_ap2, c_max2, c_left, c_right, c_mid, c_rcount, c_bp) => {
338342
// future color: should be runAColor & runBColor
339343
resetArrayA(vis, "nat", a, c_left, c_mid, c_right, c_rcount, runAColor, runCColor);
340-
if (isMergeCopyExpanded()) vis.arrayB.set(b, 'msort_arr_nat');
344+
if (isMergeCopyExpanded()) {
345+
vis.arrayB.set(b, 'msort_arr_nat');
346+
assignVarToB(vis, 'bp', c_bp, size);
347+
348+
}
341349
assignVarToA(vis, 'ap2', c_ap2, size);
342350
assignVarToA(vis, 'max2', c_max2, size);
343351
// highlight sorted elements green
344352
for (let i = c_left; i <= c_right; i++) highlightB(vis, i, sortColor);
345-
}, [A, B, ap2, max2, left, right, mid, runcount]);
353+
}, [A, B, ap2, max2, left, right, mid, runcount, bp]);
346354

347355
// copy merged elements from B to A
348356
for (let i = left; i <= right; i++) {
@@ -376,6 +384,7 @@ export function run_msort() {
376384
assignVarToA(vis, 'left', c_left, size);
377385
assignVarToA(vis, "right", c_right, size);
378386
}
387+
// assignVarToA(vis, "size", size, size);
379388

380389

381390
}, [A, left, right, runcount]);

0 commit comments

Comments
 (0)