How to update element priorities in a heap for Prim's Algorithm?
I am studying Prim's Algorithm. There is a part within the code the next vertex across the cut will be coming to the set of the vertices belonging to the MST . While doing that, we also have to 'update all vertices in the other set which are adjacent to the departing vertex'. This is a snapshot from CLRS : The interesting part lies in line no. 11. But since we are using a heap here, we have access to only the minimum element, right ( heap[0] )? So how do we search and update vertices from the heap even though they are not the minimum one and thus we have knowing where they are except by linear