MCPcopy Create free account
hub / github.com/douchuan/algorithm / QuickFindUF

Class QuickFindUF

src/common/uf.rs:41–44  ·  view source on GitHub ↗

The QuickUnionUF represents a union–find data type (also known as the disjoint-sets data type). It supports the classic union and find operations, along with a count operation that returns the total number of sets. The union–find data type models a collection of sets containing n elements, with each element in exactly one set. The elements are named 0 through n–1. Initially, there are n sets, wit

Source from the content-addressed store, hash-verified

39/// For alternative implementations of the same API, see
40/// UF, QuickFindUF, and WeightedQuickUnionUF.
41pub struct QuickFindUF {
42 id: Vec<usize>, // id[i] = component identifier of i
43 count: usize, // number of components
44}
45
46/// In particular, suppose that we use quick-find for the dynamic connectivity
47/// problem and wind up with a single component. This requires at least N - 1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected