构造MST

作者: 98Future | 来源:发表于2017-11-05 13:40 被阅读0次

Version1

Version2:

我在做的时候有点卡在如何加速runtime了。。一开始没想到要用PriorityQueue

然后就发现非常难找到smallest cost edge that points to a vertex in included regions.

Time Complexity of the above program is O(V^2). If the input graph is represented using adjacency list, then the time complexity of Prim’s algorithm can be reduced to O(E log V) with the help of binary heap. 

reason:

相关文章

网友评论

      本文标题:构造MST

      本文链接:https://www.haomeiwen.com/subject/fuwcmxtx.html