Table of Contents

Mojo struct

TreeUnionFind

@memory_only
struct TreeUnionFind

Aliases

  • width = 2

Fields

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

Implemented traits

AnyType, Deinitable, Movable

Methods

__init__

fn def __init__(out self, size: Int)

Args:

  • size (Int)
  • self (Self)

Returns:

Self

__deinit__

fn def __deinit__(deinit self)

Args:

  • self (Self)

union_

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

Args:

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

find

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

Args:

  • self (Self)
  • x (Int)

Returns:

Int

components

fn def components(self) -> List[Int]

Args:

  • self (Self)

Returns:

List[Int]