Dijkstra's Algorithm

Please explain why he used set instead of heap?

@Karanveer we can use a heap also, in sets it is guaranteed that each node is present only once, whereas in heaps a node may be present more than once!
however this is a little less thing to worry about! it’s your choice , (personally I use heaps only!)