Skip to content

Commit 8c00e98

Browse files
committed
fix: changed to pointer receivers
1 parent 0785f30 commit 8c00e98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

graph/unionfind.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func NewUnionFind(s int) UnionFind {
3434

3535
// Find finds the root of the set to which the given element belongs.
3636
// It performs path compression to make future Find operations faster.
37-
func (u UnionFind) Find(q int) int {
37+
func (u *UnionFind) Find(q int) int {
3838
if q != u.parent[q] {
3939
u.parent[q] = u.Find(u.parent[q])
4040
}
@@ -43,7 +43,7 @@ func (u UnionFind) Find(q int) int {
4343

4444
// Union merges the sets, if not already merged, to which the given elements belong.
4545
// It performs union by rank to keep the tree as flat as possible.
46-
func (u UnionFind) Union(p, q int) {
46+
func (u *UnionFind) Union(p, q int) {
4747
rootP := u.Find(p)
4848
rootQ := u.Find(q)
4949

0 commit comments

Comments
 (0)