Union Find pros and cons

it2025-07-16  10

UF’s biggest pro is that it is convenient to add or delete connections. For example, in Knuth’s MST algorithm, you need to add black edges contiguously, so using UF is good.

If you have a fixed shape of graph, DFS can be better than UF.

最新回复(0)