Complexity : O(N^2) or O((M + N)log N)
Purpose: Find the shortest path between two nodes in some given weighted graph; provided the target is reachable, and there is no negative edge.
Doubt: Naive implementation of quadratic time is optimal only for dense graphs. The optimal version for sparse graphs can be implemented using Heaps or the Priority Queue.
The problem with C++'s priority_queue is more of a max heap based structure; I guess we need a min heap instead. So how should I use this the other way?
Using priority_queue could make things messy; will using a set suffice; or could that cause TLE? I'll attach my implementation once I see it's correct and make it readable.