Mojo struct
UnionFind
@memory_only
struct UnionFind
Fields
- parent (
List[Int]) - size (
List[Int]) - next_label (
Int)
Implemented traits
AnyType, ImplicitlyDestructible
Methods
__init__
fn __init__(out self, N: Int)
Args:
- N (
Int) - self (
Self)
Returns:
Self
union
fn union(mut self, m: Int, n: Int)
Args:
- self (
Self) - m (
Int) - n (
Int)
fast_find
fn fast_find(mut self, var n: Int) -> Int
Args:
- self (
Self) - n (
Int)
Returns:
Int