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 graph, the spanning tree of G is a maximal connected subgraph containing all n vertices of G. F
1-6
If graph G is a connected graph, then G must have a unique minimum spanning tree. F
2-1
Which of the following is true? A
A.Prim’s algorithm initialises(初始化) with a vertex(顶点)
B.Prim’s algorithm initialises with a edge(边)
C.Prim’s algorithm initialises with a vertex which has smallest edge
D.Prim’s algorithm initialises with a forest
2-2
Consider the following statements.
S1. Kruskal’s algorithm might produce a non-minimal spanning tree.
S2. Kruskal’s algorithm can efficiently implemented using the disjoint-set data structure. D
(Kruskal 算法可以使用不相交集数据结构有效地实现)
A.S1 is true but S2 is false
B.Both S1 and S2 are false
C.Both S1 and S2 are true
D.S2 is true but S1 is false
2-5
The minimum spanning tree of any connected weighted graph ____ B
A.must be unique
B.must have a unique minimum weight
C.must not be unique
D.may not exist
数据结构与算法 DFS-BFS遍历&MST
最新推荐文章于 2022-03-23 22:31:42 发布