Dikastra Algorithm

In implementation of dikastra algo why are we using set instead of priority queue what are its advantages wrt to priority queues and disadvantage also (if any)

hello @shashankmaheshwari054

priority queue will consume some more space and also do more iteration compare to set because we are not removing previous enteries from the pq while inserting the updated value.

rest evrything is same for both the implementations

but in implementation using priority queue we are poping out min weight node each time

yes … but if any neigbour values get updated then in that case we are direcly inseerting the updated value without removing any previous value