MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / merge

Method merge

src/graph/disjoint_set_union.rs:75–93  ·  view source on GitHub ↗

Merges the sets containing `first_elem` and `sec_elem` using union by size. The smaller set is always attached to the root of the larger set to ensure balanced trees. # Parameters - `first_elem`: The first element whose set is to be merged. - `sec_elem`: The second element whose set is to be merged. # Returns The root of the merged set, or `usize::MAX` if both elements are already in the same

(&mut self, first_elem: usize, sec_elem: usize)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 3

test_disjoint_set_unionFunction · 0.80
calculate_answersMethod · 0.80
kruskalFunction · 0.80

Calls 1

find_setMethod · 0.80

Tested by 1

test_disjoint_set_unionFunction · 0.64