【发布时间】:2021-10-21 16:35:06
【问题描述】:
这是我的伪代码的 sn-p,用于在给定图形 G 的情况下查找每个强连接组件 (SCC) 的 MST:
Number of SCC, K <- apply Kosaraju's algorithm on Graph G O(V + E)
Loop through K components:
each K components <- apply Kruskal's algorithm
据我所知,克鲁斯卡尔算法的运行时间为 O(E log V)。
但是,我不确定循环的最坏情况时间复杂度。我的想法是当 K = 1 时会发生最坏的情况。因此,大 O 时间复杂度只是 O(E log V)。
我不知道我的想法是否正确,或者是否正确,有什么理由。
【问题讨论】:
-
这能回答你的问题吗? Time Complexity of the Kruskal Algorithm?