/** * uf_find - Find the root of a node and perform path compression * @node: the node to find the root of * * This function returns the root of the node by following the parent * pointers. It also performs path compression, making the tree shallower. * * Returns the root node of the set containing node.
*/ struct uf_node *uf_find(struct uf_node *node)
{ struct uf_node *parent;
/** * uf_union - Merge two sets, using union by rank * @node1: the first node * @node2: the second node * * This function merges the sets containing node1 and node2, by comparing * the ranks to keep the tree balanced.
*/ void uf_union(struct uf_node *node1, struct uf_node *node2)
{ struct uf_node *root1 = uf_find(node1); struct uf_node *root2 = uf_find(node2);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.