Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while pqueue is not empty:
- distance, node = pqueue.delete_min()
- if node has been visited:
- continue
- else:
- mark node as visited
- if node == target:
- break
- for each neighbor of node:
- pqueue.insert(distance + distance_to_neighbor, neighbor)
- Queue | T_e | T_d | T_k | w/o Dec-Key | w/Dec-Key
- ---------------+--------+--------+--------+-------------+---------------
- Binary Heap |O(log N)|O(log N)|O(log N)| O(M log N) | O(M log N)
- Binomial Heap |O(log N)|O(log N)|O(log N)| O(M log N) | O(M log N)
- Fibonacci Heap | O(1) |O(log N)| O(1) | O(M log N) | O(M + N log N)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement