1.

Regarding implementation of Depth First Search using stacks, what is the maximum distance between two nodes present in the stack? (considering each edge length 1)(a) Can be anything(b) 0(c) At most 1(d) Insufficient InformationThe question was posed to me during an interview for a job.Question is taken from Depth First Search topic in division Graph Search of Data Structures & Algorithms II

Answer»

The correct OPTION is (a) Can be anything

The best I can explain: In the stack, at a time, there can be nodes which can DIFFER in many levels. So, it can be the MAXIMUM distance between TWO nodes in the GRAPH.



Discussion

No Comment Found

Related InterviewSolutions