Skip to content

Commit d6cf36a

Browse files
remove left when left is equal to the size
1 parent 92f9b52 commit d6cf36a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/algorithms/controllers/msort_arr_bup.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ function assignVarToB(vis, variable_name, index, size) {
133133
function displayRunlength(vis, runlength, size) {
134134
let text = 'runlength = ' + runlength;
135135
let index = runlength - 1;
136+
136137
assignVarToA(vis, text, index, size);
137138
}
138139

@@ -416,7 +417,9 @@ export function run_msort() {
416417
for (let i = old_left; i <= c_right; i++) {
417418
unhighlight(vis, i, colorC);
418419
}
419-
assignVarToA(vis, 'left', c_left, size);
420+
if (c_left < size) {
421+
assignVarToA(vis, 'left', c_left, size);
422+
}
420423

421424
}, [left2, left, right]);
422425

0 commit comments

Comments
 (0)