DFS(深度优先) 时间复杂性:采用邻接矩阵存储结构时,查找所有顶点的邻接点所需时间为O(|V|2);
而采用邻接表时,找邻接点所需时间为O(|E|)。因此,DFS的时间复杂度为O(|V|+|E|) 。
BFS和DFS一样;
以邻接矩阵为存储结构的Prim算法中,时间复杂度为O(|V|2);
邻接表作为存储结构,Prim时间复杂度改进为O(|E|log|V|)。
Kruskal算法总体时间复杂度为O( |E|·log|V| )
1-1
Prim’s algorithm is to maintain a forest and to merge two trees into one at each stage. F
1-2
Kruskal’s algorithm is to maintain a forest and to merge two trees into one at each stage. T
1-3
Kruskal’s algorithm is to grow the minimum spanning tree by adding one edge, and thus an associated vertex, to the tree in each stage. F
Kruskal(应为Prim) 的算法是通过在每个阶段向树添加一条边并因此添加一个关联的顶点来生长最小生成树。
1-4
The minimum spanning tree of a connected weighted graph with vertex set V={ A, B, C, D, E } and weight set W={ 1, 3, 2, 5, 2, 7, 9, 8, 4 } must be unique. F
1-5
If graph G is a connected gra
数据结构与算法 DFS-BFS遍历&MST
最新推荐文章于 2024-07-15 20:57:41 发布