uf_union(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– uf_union β€” the "let's be friends" function πŸ’–

okay so quick vibe check: this is uf_union(9) from the Kernel API Manual, and no cap it's one of the most useful little functions in the whole kernel friend group. it's literally a matchmaker for sets 🫢


✨ NAME ✨

uf_union β€” merge two sets, using union by rank πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

void uf_union (struct uf_node *node1 , struct uf_node *node2 );

🌸 ARGUMENTS 🌸

  • node1 β€” the first node πŸ₯‡
  • node2 β€” the second node πŸ₯ˆ

like, they're just two nodes, bestie. two little guys about to become one big friend group.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜•: this function merges the sets containing node1 and node2, by comparing the ranks to keep the tree balanced.

that's it. that's the whole thing. it literally does a rank comparison so the tree doesn't turn into a sad little stick, and then boom πŸ’₯ β€” the two sets are one set now. main character energy for ur disjoint-set forest, fr fr. balance is the vibe check and this function passes it every time 🌈


πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page, bestie β€” go union some sets and slay ✨

signing off with love from the ./lib girlies, October 2026 πŸŽ€πŸ’œ

πŸ“¦ where this page comes from