Gast's blog

By Gast, history, 6 months ago, In English

Which is better for the dijkstra set or the priority_queue?

  • Vote: I like it
  • +10
  • Vote: I do not like it

»
6 months ago, # |
  Vote: I like it +8 Vote: I do not like it

I believe priority queue is better as it uses heap instead of a balanced BST, which makes it better in terms of time complexity(better as avl rotations have higher constant factor than extract max of heap) and space complexity(no need of pointer to left and right child as would have been needed in balanced tree for set).

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I use SET for Dijkstra.