Skip to content

Instantly share code, notes, and snippets.

@Israel-Miles
Created October 9, 2021 23:21
Show Gist options
  • Save Israel-Miles/e233be2e411d24ce4ccb3da13ee719c2 to your computer and use it in GitHub Desktop.
Save Israel-Miles/e233be2e411d24ce4ccb3da13ee719c2 to your computer and use it in GitHub Desktop.
type UnionFind struct {
root []int
}
func NewUnionFind(size int) *UnionFind {
root := make([]int, size)
for i := 0; i < size; i++ {
root[i] = i
}
return &UnionFind{
root: root,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment