判断题
1.在一个有权无向图中,若b到a的最短路径距离是12,且c到b之间存在一条权为2的边,则c到a的最短路径距离一定不小于10。
2.P 是顶点 S 到 T 的最短路径,如果该图中的所有路径的权值都加 1,P 仍然是 S 到 T 的最短路径。
3.对于带权无向图 G = (V, E),M 是 G 的最小生成树,则 M 中任意两点 V1 到 V2 的路径一定是它们之间的最短路径。
4.Let P be the shortest path from S to T. If the weight of every edge in the graph is incremented by 1, P will still be the shortest path from S to T.
选择题
1.若要求在找到从S到其他顶点最短路的同时,还给出不同的最短路的条数,我们可以将Dijkstra算法略作修改,增加一个count[]数组:count[V]记录S到顶点V的最短路径有多少条。则count[V]应该被初始化为:
选项 A 对所有顶点都有count[V]=1 B 对所有顶点都有count[V]=0 C count[S]=1;对于其他顶点V则令count[V]=0 D count[S]=0;对于其他顶点V则令count[V]=1
2.我们用一个有向图来表示航空公司所有航班的航线。下列哪种算法最适合解决找给定两城市间最经济的飞行路线问题?
选项 A Dijkstra算法 B Kruskal算法 C 深度优先搜索 D 拓扑排序算法
3.In a weighted graph, if the length of the shortest path from b to a is 10, and there exists an edge of weight 3 between c and b, then how many of the following statements is/are TRUE?
The length of the shortest path from c to a must be 13.
The length of the shortest path from c to a must be 7.
The length of the shortest path from c to a must be no greater than 13.
The length of the shortest path from c to a must be no less than 7.
4.数据结构中Dijkstra算法用来解决哪个问题?
5.使用迪杰斯特拉(Dijkstra)算法求下图中从顶点1到其他各顶点的最短路径,依次得到的各最短路径的目标顶点是:
选项 A 5, 2, 3, 4, 6 B 5, 2, 3, 6, 4 C 5, 2, 4, 3, 6 D 5, 2, 6, 3, 4
6.若要求在找到从S到其他顶点最短路的同时,还给出不同的最短路的条数,我们可以将Dijkstra算法略作修改,增加一个count[]数组:count[V]记录S到顶点V的最短路径有多少条。则count[V]应该被初始化为:
选项 A count[S]=1;对于其他顶点V则令count[V]=0 B count[S]=0;对于其他顶点V则令count[V]=1 C 对所有顶点都有count[V]=1 D 对所有顶点都有count[V]=0
7.下面的哪个算法可以求图的最短路径____。
选项 A Kruskal算法 B Dijkstra算法 C Prim算法 D 哈夫曼算法
8.If an undirected graph G = (V, E) contains 7 vertices. Then to guarantee that G is connected in any cases, there has to be at least __ edges.
9.使用迪杰斯特拉(Dijkstra)算法求下图中从顶点1到其他各顶点的最短路径,依次得到的各最短路径的目标顶点是:
选项 A 2, 5, 3, 4, 6, 7 B 2, 4, 3, 6, 5, 7 C 2, 3, 4, 5, 6, 7 D 5, 2, 6, 3, 4, 7
10.试利用Floyed算法,求下图所示有向图的各对顶点之间的最短路径。下列选项哪个给出了正确的最短路径长度矩阵和最短路径矩阵?