Are a and b already connected? If you're adding undirected edges one at a time, union find answers that by comparing two roots. 1. Follow the parents Each node starts in its own group with parent[x] =
Algorithms, AI Engineering, Full Stack Systems
Code got cheap. Being right didn’t. Writing about AI engineering, distributed systems, algorithms, and product.
Markdown supported · ⌘↵ to post
No responses yet.