What happens when while loop in line 4 is changed to while Q>1?
A. While loop gets executed for v times
B. While loop gets executed for v-1 times
C. While loop gets executed only once
D. While loop does not get executed
Answer:B
What happens when while loop in line 4 is changed to while Q>1?
A. While loop gets executed for v times B. While loop gets executed for v-1 times C. While loop gets executed only once D. While loop does not get executed
Explanation: In the normal execution of Dijkstra’s Algorithm, the while loop gets executed V times. The change in the while loop statement causes it to execute only V – 1 times.