Question

Like in title. What is the optimal way to keep nodes in memory for Kruskal's algorithm, and why?

Was it helpful?

Solution

Kruskal algorithm is basically dong exactly what the Disjoint set forest structure is meant to do. This structure starts with all nodes being in separate components and then supports operations of the kind

Join nodes A and B

and

Are Nodes A and B in the same cover tree already?

That is exactly why I would tell this is the most suitable representation for the nodes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top