Interview concept

What is Union-Find (disjoint set union)?

Union-Find, also called disjoint set union, maintains a collection of disjoint sets with two operations: find, which returns a set representative, and union, which merges two sets. Path compression and union by rank make it near-constant amortized time.

Summary

Key takeaways

Union-Find - Interview Concepts - ExtraBrain is part of ExtraBrain's local-first Mac workflow for live interviews, meetings, transcription, provider control, and responsible AI use.

Page focus

Union-Find, also called disjoint set union, maintains a collection of disjoint sets with two operations: find, which returns a set representative, and union, which merges two sets. Path compression and union by rank make it near-constant amortized time.

Platform fact

ExtraBrain has 1 current public platform family, macOS, with support for 2 Mac CPU families: Apple Silicon and Intel.

Data-flow fact

ExtraBrain has 3 configurable data paths to review before sensitive work: local Parakeet transcription, local Gemma 4 where installed and compatible, and external providers you choose.

Interview concept

How it works

Core operations

Find returns the root of an element, and union merges two trees under a single root.

Optimizations

Path compression flattens trees and union by rank keeps them shallow, giving near-constant amortized time.

When to use it

Use it for connectivity, cycle detection in undirected graphs, and Kruskal minimum spanning trees.

Interview concept

Responsible use

Use any live AI assistant only where interview, workplace, school, and platform rules allow it. Do not use generated answers to misrepresent your skills, experience, or authorship.

FAQ

Common questions.

Short answers for people and crawlers comparing ExtraBrain with other live AI assistants.

What problems use Union-Find?

Connected components, cycle detection in undirected graphs, and building minimum spanning trees with Kruskal.

How fast is Union-Find?

With path compression and union by rank, operations run in near-constant amortized time, the inverse Ackermann function.