4 ms·
Also known as union-find. Favorite implementation is Sedgewick's weighted quick union with path compression from the first chapter of his algorithms text. Als
by a-dub 8y ago
Also known as union-find. Favorite implementation is Sedgewick's weighted quick union with path compression from the first chapter of his algorithms text. Also cool is an implementation in the graph chapter which actually makes use of DFS instead.