Shouldn't we use set in dijkstra algorithm instead of priority queue?

Revision en1, by Shivam164, 2022-07-17 17:54:27

As while running Dijkstra's algorithm using a priority queue, we are keeping extra unnecessary nodes in the priority queue which we would not need in the future, but we can remove such nodes while inserting a new node(of the same value) using set.

Tags dijkstra

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Shivam164 2022-07-17 17:54:27 320 Initial revision (published)