Table of Contents

Mojo struct

TreeUnionFind

@memory_only
struct TreeUnionFind

Aliases

  • width = 2

Fields

  • size (Int)
  • is_component (List[Bool])

Implemented traits

AnyType, ImplicitlyDestructible

Methods

__init__

fn __init__(out self, size: Int)

Args:

  • size (Int)
  • self (Self)

Returns:

Self

__del__

fn __del__(deinit self)

Args:

  • self (Self)

union_

fn union_(mut self, x: Int, y: Int)

Args:

  • self (Self)
  • x (Int)
  • y (Int)

find

fn find(mut self, x: Int) -> Int

Args:

  • self (Self)
  • x (Int)

Returns:

Int

components

fn components(self) -> List[Int]

Args:

  • self (Self)

Returns:

List[Int]