Implement Union-Find (Disjoint Set) data structure
- Dominant language
- Hy
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Create an efficient implementation of the Union-Find (Disjoint Set) data structure:
## Core operations:
- MakeSet - Create a new set with a single element
- Find - Determine which set an element belongs to
- Union - Merge two sets
## Optimizations to implement:
- Path compression for Find operation
- Union by rank/size
- Path splitting
- Path halving
## Applications to demonstrate:
- Kruskal's algorithm for MST
- Cycle detection in undirected graphs
- Connected components in a graph
- Least common ancestor in trees
- Percolation problems
## Requirements:
- Provide detailed complexity analysis
- Include amortized analysis
- Create comprehensive test cases
- Document practical applications
This data structure is fundamental for efficient implementations of many graph algorithms and has applications in network connectivity problems.
Contributor guide
Assessment
This issue has not been assessed yet.