[][src]Struct competitive_hpp::union_find::UnionFind

pub struct UnionFind<T> { /* fields omitted */ }

UnionFind

Example:

use competitive_hpp::prelude::*;
// 0 ━━━━━ 1 ━━━━━ 4
//
// 2 ━━━━━ 3
let mut uf = UnionFind::new(5usize);
uf.union(0, 1);
uf.union(2, 3);
uf.union(1, 4);

assert_eq!(uf.find(0), uf.find(1));
assert_eq!(2, uf.num_of_groups());
assert!(uf.is_same(0, 1));
assert_eq!(uf.rank(2), 0);
assert_eq!(uf.group_size(0), 3);

Implementations

impl<T> UnionFind<T> where
    T: PrimInt + NumAssignOps + Unsigned
[src]

pub fn new(n: T) -> Self[src]

pub fn find(&mut self, x: T) -> T[src]

pub fn union(&mut self, x: T, y: T)[src]

pub fn is_same(&mut self, x: T, y: T) -> bool[src]

pub fn group_size(&mut self, x: T) -> T[src]

pub fn rank(&self, x: T) -> T[src]

pub fn num_of_groups(&self) -> T[src]

Trait Implementations

impl<T: Clone> Clone for UnionFind<T>[src]

impl<T: Debug> Debug for UnionFind<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for UnionFind<T> where
    T: RefUnwindSafe

impl<T> Send for UnionFind<T> where
    T: Send

impl<T> Sync for UnionFind<T> where
    T: Sync

impl<T> Unpin for UnionFind<T> where
    T: Unpin

impl<T> UnwindSafe for UnionFind<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.