sorting - how to calculate the time complexity of kurskal's algorithm which is may be O(E log E) = O(E log V).? -
please tell me procedure how calculate time complexity of kruskal's theorem? know algorithm of kruskal algorithm didn't know pseudo code , calculation of time complexity ... complexity of kruskal algo o(e log e) = o(e log v) (wikipedia). didn't know how calculate that..
kruskal's algorithm based on union-find of forests until form single tree. @ each step connecting 2 trees using single edge.
the pseudo code (from wikipedia):
tree = {} each v: make-set(v) each edge (u,v) ordered w(u,v): if find(u) != find(v): tree.add((u,v)) union(u,v) return tree
the bottleneck of algorithm sorting edges according weight. sorting done in o(nlogn)
@ best, , sorting list of size e
, giving total of o(eloge)=o(elog(v^2))=o(2elogv)=o(elogv)
Comments
Post a Comment