Today I was implementing Dijkstra Algorithm and i wanted to do something different
I wanted to push ( dist[b], b ) instead of pushing ( -dist[b] , b) . Here we are pushing -dist[b] because we want it to be in ascending order
I wanted to push positive value in the priority queue
So I would like to create min heap in a priority queue.
Here is the min-heap in priority queue :
How to do it for priority queue which contains pairs
Here is my code :
And it didn’t work in my IDE and here is what error it showed :