InterviewSolution
Saved Bookmarks
| 1. |
The maximum number of times the decrease key operation performed in Dijkstra’s algorithm will be equal to ___________(a) Total number of vertices(b) Total number of edges(c) Number of vertices – 1(d) Number of edges – 1This question was addressed to me at a job interview.This is a very interesting question from Shortest Path topic in portion Shortest Path of Data Structures & Algorithms II |
|
Answer» CORRECT CHOICE is (b) Total number of edges Easiest explanation - If the total number of edges in all adjacency list is E, then there will be a total of E number of ITERATIONS, hence there will be a total of at most E DECREASE key OPERATIONS. |
|