数据结构与算法 最短路径

迪杰斯特拉(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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值