Apply Dijkstra’s algorithm for the following graph:

Initially the set S contains the vertex A, i.e. S = {A}.

Finally, in which of the following order the vertices will be included in S, if array P holds the shortest distance from source to each vertex, then what will be P[A - E]?

1

S = {A,B,C,D,E}

P[A] = 0, P[B] = 8, P[C] = 13, P[D] = 5, P[E] = 7
2

S = {A,D,E,B,C}

P[A] = 0, P[B] = 8, P[C] = 9, P[D] = 5, P[E] = 7
3
S = {A,D,E,C,B}
 
P[A] = 0, P[B] = 8, P[C] = 9, P[D] = 5, P[E] = 7
4
S = {A,D,E,B,C}
 
P[A] = 0, P[B] = 8, P[C] = 13, P[D] = 5, P[E] = 7

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation