迪杰斯特拉(Dijkstra)算法:稠密图的时间复杂度是O(|V|2),稀疏图可以改进为O(|E|log|V|)
1-2
P 是顶点 S 到 T 的最短路径,如果该图中的所有路径的权值都加 1,P 仍然是 S 到 T 的最短路径。 F
走的边多,最短路径加的数大,可能导致最短路径不是最短。
2-2
若要求在找到从S到其他顶点最短路的同时,还给出不同的最短路的条数,我们可以将Dijkstra算法略作修改,增加一个count[]数组:count[V]记录S到顶点V的最短路径有多少条。则count[V]应该被初始化为: A
A.count[S]=1; 对于其他顶点V则令count[V]=0
B.count[S]=0; 对于其他顶点V则令count[V]=1
C.对所有顶点都有count[V]=1
D.对所有顶点都有count[V]=0
2-3
Which of the following statements is FALSE about the shortest path algorithms? C
A.Dijkstra’s algorithm works out the shortest path in increasing order of distances.
Dijkstra 算法以距离递增的顺序计算出最短路径
B.Single-source algorithms work fast on sparse graphs when finding the shortest path between any pair of vertices.
当找到任何一对顶点之间的最短路径时,单源算法在稀疏图上工作得很快
C.Negative-cost edge in a directed graph will cause infinite loop in Dijkstra’s algorithm.
有向图中的负成本边(应为负成本环)将导致 Dijkstra 算法中的无限循环
D.BFS can work out the shortest path when costs of all the edges are equal.
当所有边的成本相等时,BFS 可以计算出最短路径
2-9
Dijkstra’s Algorithm cannot be applied on ______________ B
A.Directed and weighted graphs
B.Graphs having negative weight function
C.Unweighted graphs
D.Undirected and unweighted graphs
数据结构与算法 最短路径
最新推荐文章于 2025-05-12 19:20:28 发布