A <- 0 // initially A is empty
for each vertex v V[G] // line 2-3 takes O(V) time
do Create-Set(v) // create set for each vertex
sort the edges of E by nondecreasing weight w
for edge E, in order by nondecreasing weight
do if Find-Set(u) != Find-Set(v) // u&v on different trees
then A <- A U {(u,v)}
Union(u,v)
return A
Create-Set(u): create a set containing u.
Find-Set(u): Find the set that contains u.
Union(u, v): Merge the sets containing u and v.
O(E*log(E))
Awesome cheat sheet! Wish it covered countability and undecidability but it's rick solid for what is has!
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.