22

来源:互联网 发布:win10修改无线网卡mac 编辑:程序博客网 时间:2024/05/06 09:57

 

Spanning tree: an acyclic subset T in E that connects all of the vertices and whose total weight is minimized.--greedy algoriths

 

Analysis:

 

Kruskal's algorithm: O(ElgV) using ordianry heap

Prim's algorithm: O(ElgV) using ordianry heap; O(E+VlgV) Prim's algorithm using fibonacci if |V| is much smaller than |E|

 

 

Kruskal's algorithm, the set A is a forest. always add a least-weight edge connects two distinct components

Prim's algorithm: set S forms a tree. always add a least-weight connecting the tree to a vertex not in the tree

原创粉丝点击