You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/1-1000/743-network-delay-time.md
+15-2Lines changed: 15 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -41,13 +41,26 @@ We will send a signal from a given node `k`. Return _the **minimum** time it tak
41
41
##Intuition
42
42
We can solve it via both**Bellman-Ford algorithm** and**Dijkstra's algorithm**.
43
43
44
-
`Bellman-Ford algorithm` has less code and can handle the situation of**negative** edge weights, but it is slower than`Dijkstra's algorithm` if it is not optimized.
44
+
###Bellman-Ford Algorithm
45
+
Here is an animation about_Bellman-Ford algorithm_:
*`Bellman-Ford algorithm` has less code and can handle the situation of**negative** edge weights, but it is slower than`Dijkstra's algorithm` if it is not optimized.
45
50
The following code will introduce how to optimize.
46
51
47
-
`Dijkstra's algorithm` always takes the shortest path, so it is more efficient, but it requires writing more code and it cannot handle the situation of**negative** edge weights.
52
+
*`Dijkstra's algorithm` always takes the shortest path, so it is more efficient, but it requires writing more code and it cannot handle the situation of**negative** edge weights.
48
53
49
54
For a detailed description of**Dijkstra's algorithm**, please refer to[1514. Path with Maximum Probability](../1001-2000/1514-path-with-maximum-probability.md).
Copy file name to clipboardExpand all lines: en/3001-4000/unorganized.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,12 @@ The improved way with a queue is commonly more efficient. Relaxing **All Edges**
59
59
* The time complexity of`Floyd–Warshall algorithm` is`V * V * V`. For a dense graph,`Floyd–Warshall algorithm` is still faster.
60
60
*`A* algorithm` use a`priority queue`,`pop()` to get the vertex closest to the destination vertex. We need to choose**proper math formula** to determine which one is the closest. We to the very near place of destination vertex, we can use some special method to make it can handle the last part.