判断题
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.
5.Let M be the minimum spanning tree of a weighted graph G. Then the path in M between V1 and V2 must be the shortest path between them in G.
选择题
1.在一个有权无向图中,如果顶点b到顶点a的最短路径长度是10,顶点c与顶点b之间存在一条长度为3的边。那么下列说法中有几句是正确的?
- c与a的最短路径长度就是13
- c与a的最短路径长度就是7
- c与a的最短路径长度不超过13
- c与a的最短路径不小于7
B.2句
C.3句
D.4句
2.若要求在找到从S到其他顶点最短路的同时,还给出不同的最短路的条数,我们可以将Dijkstra算法略作修改,增加一个count[]数组:count[V]记录S到顶点V的最短路径有多少条。则count[V]应该被初始化为:
B.对所有顶点都有count[V]=0
C.count[S]=1;对于其他顶点V则令count[V]=0
D.count[S]=0;对于其他顶点V则令count[V]=1
3.我们用一个有向图来表示航空公司所有航班的航线。下列哪种算法最适合解决找给定两城市间最经济的飞行路线问题?
B.Kruskal算法
C.深度优先搜索
D.拓扑排序算法
4.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.
B.2
C.3
D.4
5.数据结构中Dijkstra算法用来解决哪个问题?
B.最短路径
C.拓扑排序
D.字符串匹配
6.使用迪杰斯特拉(Dijkstra)算法求下图中从顶点1到其他各顶点的最短路径,依次得到的各最短路径的目标顶点是:
B.5, 2, 3, 6, 4
C.5, 2, 4, 3, 6
D.5, 2, 6, 3, 4
7.若要求在找到从S到其他顶点最短路的同时,还给出不同的最短路的条数,我们可以将Dijkstra算法略作修改,增加一个count[]数组:count[V]记录S到顶点V的最短路径有多少条。则count[V]应该被初始化为:
B.count[S]=0;对于其他顶点V则令count[V]=1
C.对所有顶点都有count[V]=1
D.对所有顶点都有count[V]=0
8.下面的哪个算法可以求图的最短路径____。
B.Dijkstra算法
C.Prim算法
D.哈夫曼算法
9.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.
B.15
C.16
D.21
10.使用迪杰斯特拉(Dijkstra)算法求下图中从顶点1到其他各顶点的最短路径,依次得到的各最短路径的目标顶点是:
B.2, 4, 3, 6, 5, 7
C.2, 3, 4, 5, 6, 7
D.5, 2, 6, 3, 4, 7