Skip to content

Commit

Permalink
Fix bug in ancestor code
Browse files Browse the repository at this point in the history
  • Loading branch information
huynhtrankhanh authored Nov 2, 2024
1 parent 1c1b27a commit 5752015
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion programs/DisjointSetUnion.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ procedure('ancestor', { vertex: int8, work: int8 }, () => {
if (sLess(retrieve('dsu', coerceInt64(get('work')))[0], coerceInt8(0))) {
;('break')
}
set('vertex', retrieve('dsu', coerceInt64(get('work')))[0])
store('dsu', coerceInt64(get('work')), [retrieve('result', 0)[0]])
set('work', retrieve('dsu', coerceInt64(get('work')))[0])
set('work', get('vertex'))
})
})

Expand Down

0 comments on commit 5752015

Please sign in to comment.