Блог пользователя whatthemomooofun1729

Автор whatthemomooofun1729, история, 20 месяцев назад, По-английски

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?

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
20 месяцев назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится
Implementation
»
20 месяцев назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

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);