Skip to content

Commit 2fef380

Browse files
committed
fix: stack Pop
1 parent 5ca3dbb commit 2fef380

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

10-并查集、图相关算法介绍.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func (set *UnionSet) FindFather(cur *Node) *Node {
6161
for len(path) != 0 {
6262
for i := len(path) - 1; i >= 0; i-- {
6363
set.Parents[path[i]] = cur
64+
path = path[:len(path) - 1] // 模拟栈的弹出
6465
}
6566
}
6667
return cur

0 commit comments

Comments
 (0)