First of all we need to make set of each vertices. so, that when we ask FIND-SET(v) then it should output v initially.
for each vertex V in graph G
MAKE-SET(V) // make set with only vertex V in it.
// edges are already sorted so, now we have to just add edges in order given if they don't form cycle.
for each edge (u,v) that belong to G
{
if FIND-SET(v) != FIND-SET(u)
T = T U {u,v} // T here is tree that needs to be constructed.
UNION( u,v) // that is unify two sets whose representative are u and v.
}
so , time complexity = |V| time for making subset for each vertex + |E| time checking whether cycle exists or not. as FIND-SET and UNION runs in O(1) time
=O( |V| + |E|)
=O(m+n)