Master Data Structures & Algorithms For FREE at AlgoMap.io!
@user-jm6gp2qc8x2 ай бұрын
heapq is doing a lot of heavy lifting for us here
@saurabhbhagat4528Ай бұрын
Yes, and here in JavaScript I have to implement create/insert/delete everytime a heap is involved 😅
@ericsigne65758 күн бұрын
@@saurabhbhagat4528 if it's in leetcode, you can just call the min priority queue class as new MinPriorityQueue(). The same logic can be used for max priority queue.
@JSH19942 ай бұрын
thanks for the clear explanation!
@__chroma__8660Ай бұрын
is ther eany similarity between the min heap in dijkstras, and the min heap used in prims mst algo?
@mehraan859228 күн бұрын
Should we not update the cost to reach a node even if it is already in min_times because a different path may give a lesser cost/time? Please help.
@chisomedoka56513 ай бұрын
Great video once again, please create one for BellmanFord
@aakashs1806Ай бұрын
Can we solve this problem in prims algorithm??
@AnkitKumar-qe9to5 ай бұрын
Thank you @GregHogg
@GregHogg5 ай бұрын
You're very welcome :)
@e889.6 ай бұрын
Never stop uploading
@GregHogg5 ай бұрын
Won't
@e889.5 ай бұрын
@@GregHogg where to DM you??
@ashokchourasia6 ай бұрын
correct the title of video
@GregHogg6 ай бұрын
Thanks so much, fixed :)
@otheraccount1270Ай бұрын
Heapq.heapify(min_heap) missing in code.
@mehraan859228 күн бұрын
There is only one value initialized there and after that all values pushed are heappushed so there is no need for it. I maybe wrong. :)
@maybae106 күн бұрын
@@mehraan8592 you're absolutely right! no need to heapify as the heap initially starts w a single value. then we heappush every val we add; this operation adds the curr val to end of arr and makes sure the position of the curr val maintains heap properties, moving it up or down as needed (log(N) time)