Skip to content

Commit d7d9d06

Browse files
committed
try fix
1 parent 8af9a08 commit d7d9d06

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

_posts/2024/2024-10-08-algorithm-exercises2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Use Dijkstra's algorithm to find the shortest path distances from $s$ to all oth
122122

123123
For each candidate road $(u, v)$ in $C$: obtain the shortest path distances of $suvt$ and $svut$, which can be calculated by $d_s(u)+w(u,v)+d_t(v)$ and $d_s(v)+w(v,u)+d_t(u)$ respectively. We update the shortest path distance if we find a larger decrease. After all iterations, return the candidate pair that results in the maximum decrease in the driving distance.
124124

125-
Time complexity: Dijkstra's algorithm with binary heap takes $O((\lvert V \rvert+ \lvert E \rvert)\log V)$. Iterating through candidate roads takes $O(2*\lvert C \rvert)$. So the total time complexity is $O(2(\lvert V \rvert+\lvert E \rvert)\log V + 2*\lvert C \rvert)=O((\lvert V \rvert+\lvert E \rvert)\log V)$.
125+
Time complexity: Dijkstra's algorithm with binary heap takes $O((\lvert V \rvert+ \lvert E \rvert)\log V)$. Iterating through candidate roads takes $O(2 * \lvert C \rvert)$. So the total time complexity is $O(2(\lvert V \rvert+\lvert E \rvert)\log V + 2 * \lvert C \rvert)=O((\lvert V \rvert+\lvert E \rvert)\log V)$.
126126

127127
Pseudocode:
128128

0 commit comments

Comments
 (0)