All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · December 2019

Consider a weighted directed graph. The current shortest distance from source S to node x is represented by d[x]. Let d[v]= 29, d[u]= 15, w[u,v]=12. What is the updated value of d[v] based on current information?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. 27

Explanation

d[v] = min(29, d[u] + w(u, v)) = min(29, 15 + 12) = 27.

More Data Structures and Algorithms questions