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
| 39 | /// For alternative implementations of the same API, see |
| 40 | /// UF, QuickFindUF, and WeightedQuickUnionUF. |
| 41 | pub 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 |
nothing calls this directly
no outgoing calls
no test coverage detected