https://ide.codingblocks.com/s/42630

https://ide.codingblocks.com/s/42630
in this code i am confused in line 30…please explain the bool operator and its working…here for">" it is coming ascending and for smaller it is giving descending

priority_queue compare function works opposite than normal compare function of STL.
Basically it is used to make Max priority queue and min priority queue.
To make Min heap.
if you use > , it means IF a.distance>b.distance so send b (first) as it has opposite functionality otherwise send a first .
Whenever u get confused by this function. Just try both ways use > and then this < and choose which suits you better cozz best way to check your code is testing.
Hit like if u get it