← Back

Kruskal's Algorithm

Randomized Kruskal's Algorithm

Treats each cell as a separate set. Randomly picks walls and removes them if the cells on either side belong to different sets (union-find). Colors show distinct sets merging.

Each color = one connected component