演算法›Ch4 圖論演算法第 106 題/共 111 題
106. Shortest Path、Algorithm Design、Verification Algorithm
#AL-04-106難Shortest PathAlgorithm DesignVerification Algorithm
題組題幹(本題:B,共 2 小題)點擊展開
A weighted graph is an undirected graph with nonnegative weight assigned to each edge in E. The length of a path in G is the sum of edge weights of the edges in the path. A path P from vertex u to vertex v is said to be shortest if the length of P is smallest for all paths from vertex u to vertex v.
(13%) Now you are given a weighted graph , a specified vertex s in V, an array of size , and it is claimed that for each v in V, is the length of the shortest path from s to v. The claim may be correct or may not be. Design a linear time algorithm to check whether the claim is correct. Analyses the time complexity of your algorithm and make sure it is linear, that is, the running time of your algorithm must be .
📄 中央110
▤完整推導請見《WH 資工筆記 · 演算法》Ch4 圖論演算法