Skip to content

Commit 10c6c74

Browse files
committed
fix: from bup array to nat array
1 parent 18b72b5 commit 10c6c74

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/algorithms/controllers/msort_arr_nat.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ export function run_msort() {
346346
A[ap2] = undefined;
347347

348348
chunker.add('copyap2', (vis, a, b, c_ap1, c_ap2, c_bp, c_max1, c_max2, c_left, c_right, c_mid, c_rcount) => {
349-
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_bup');
350-
vis.array.set(a, 'msort_arr_bup');
349+
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_nat');
350+
vis.array.set(a, 'msort_arr_nat');
351351
displayMergeLabels(vis, c_ap1, c_max1, c_ap2, c_max2, c_bp, size);
352352
// future color: should be colorA & colorB
353353
highlight2Runlength(vis, c_left, c_mid, c_right, colorA, colorA);
@@ -374,8 +374,8 @@ export function run_msort() {
374374
}
375375
chunker.add('CopyRest1', (vis, a, b, c_ap1, c_max1, c_left, c_right, c_mid, c_bp, c_rcount) => {
376376

377-
vis.array.set(a, 'msort_arr_bup');
378-
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_bup');
377+
vis.array.set(a, 'msort_arr_nat');
378+
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_nat');
379379

380380
// copying A[ap1..max1]
381381
assignVarToA(vis, 'ap1', c_ap1, size);
@@ -396,8 +396,8 @@ export function run_msort() {
396396
bp = bp + 1;
397397
}
398398
chunker.add('CopyRest2', (vis, a, b, c_ap2, c_max2, c_left, c_right, c_mid, c_rcount) => {
399-
vis.array.set(a, 'msort_arr_bup');
400-
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_bup');
399+
vis.array.set(a, 'msort_arr_nat');
400+
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_nat');
401401
assignVarToA(vis, 'ap2', c_ap2, size);
402402
assignVarToA(vis, 'max2', c_max2, size);
403403

@@ -415,24 +415,25 @@ export function run_msort() {
415415
B[i] = undefined;
416416
}
417417
chunker.add('copyBA', (vis, a, b, c_left, c_right, c_rcount) => {
418-
vis.array.set(a, 'msort_arr_bup');
419-
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_bup');
418+
vis.array.set(a, 'msort_arr_nat');
419+
if (isMergeExpanded()) vis.arrayB.set(b, 'msort_arr_nat');
420420

421421
// highlight all sorted elements green
422422
for (let i = c_left; i <= c_right; i++) highlight(vis, i, colorC);
423423
set_simple_stack(vis.array, [c_rcount]);
424424
}, [A, B, left, right, runcount]);
425425

426-
runcount = runcount + 1;
427-
chunker.add('runcount+', (vis, c_rcount) => {
428-
set_simple_stack(vis.array, [c_rcount]);
429-
}, [runcount]);
426+
430427
}
428+
runcount = runcount + 1;
429+
chunker.add('runcount+', (vis, c_rcount) => {
430+
set_simple_stack(vis.array, [c_rcount]);
431+
}, [runcount]);
431432

432433
let left2 = left;
433434
left = right + 1;
434435
chunker.add('left2', (vis, a, c_left, c_rcount) => {
435-
vis.array.set(a, 'msort_arr_bup');
436+
vis.array.set(a, 'msort_arr_nat');
436437

437438
set_simple_stack(vis.array, [c_rcount]);
438439

0 commit comments

Comments
 (0)