Thursday, January 30, 2025
Google search engine
HomeData Modelling & AIData Structures | Graph | Question 5

Data Structures | Graph | Question 5

Consider an undirected unweighted graph G. Let a breadth-first traversal of G be done starting from a node r. Let d(r, u) and d(r, v) be the lengths of the shortest paths from r to u and v respectively, in G. lf u is visited before v during the breadth-first traversal, which of the following statements is correct?

(A)

d(r, u) < d (r, v)

(B)

d(r, u) > d(r, v)

(C)

d(r, u) <= d (r, v)

(D)

None of the above

Answer: (C)
Explanation:

d(r, u) and d(r, v) will be equal when u and v are at same level, otherwise d(r, u) will be less than d(r, v)

Quiz of this Question
Please comment below if you find anything wrong in the above post

Feeling lost in the world of random DSA topics, wasting time without progress? It’s time for a change! Join our DSA course, where we’ll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 neveropen!

RELATED ARTICLES

Most Popular

Recent Comments