whatthemomooofun1729's blog

By whatthemomooofun1729, history, 2 years ago, In English

I recently read that you could improve the performance of the Dijkstra algorithm by getting rid of pairs and doing comparison operator overloading (https://cp-algorithms.com/graph/dijkstra_sparse.html#getting-rid-of-pairs)

Does anyone have this implementation?

»
2 years ago, # |
  Vote: I like it +4 Vote: I do not like it
Implementation
»
2 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

Does this implementation enhancement really matter or make difference? I don't think so!

Note: we can use long long as pair<int, int>

int distance = long_long_in_priority_queue >> 32;
int vertix = long_long_in_priority_queue & ((1LL << 32) - 1);