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: leetcode/medium/1135_connecting_cities_with_minimum_cost.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,8 @@ If there was a real adaptable priority queue, there would be a feature to update
23
23
To read more about adaptable priority queues, check out [Data Structures and Algorithms in Python 1st Edition](https://www.amazon.com/Structures-Algorithms-Python-Michael-Goodrich/dp/1118290275).
24
24
25
25
This example is more of a lazy heap implementation, looking at the heapq documentation, they show an implementation of a lazy adaptable priority queue.
26
-
This will help us to get O((V + E)logV) run-time.
27
-
Without performing the lazy delete technique with a heaq, we would get O(V^2(V + E)logV) run-time.
26
+
This will help us get O((V + E)logV) run-time.
27
+
Without performing the lazy delete technique with a heaq, we would get O((V + E)^2logV) run-time.
28
28
That is because in a undirected dense graph, we would be adding duplicate entries of the same nodes into the heap.
29
29
There are a lot of incorrect implementations of Prim's Algorithm using heapq that do not perform lazy deletes out there, so be warned.
0 commit comments