pub struct UnionFind { /* private fields */ }Implementations§
Source§impl UnionFind
impl UnionFind
pub fn new(n: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn find(&mut self, x: usize) -> usize
Sourcepub fn union(&mut self, a: usize, b: usize) -> bool
pub fn union(&mut self, a: usize, b: usize) -> bool
Union two sets. Returns true if they were merged.
pub fn set_size(&mut self, x: usize) -> usize
pub fn num_sets(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UnionFind
impl RefUnwindSafe for UnionFind
impl Send for UnionFind
impl Sync for UnionFind
impl Unpin for UnionFind
impl UnsafeUnpin for UnionFind
impl UnwindSafe for UnionFind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more