1.

A person wants to visit some places. He starts from a vertex and then wants to visit every vertex till it finishes from one vertex, backtracks and then explore other vertex from same vertex. What algorithm he should use?(a) Depth First Search(b) Breadth First Search(c) Trim’s algorithm(d) Kruskal’s AlgorithmThis question was addressed to me during an online exam.My doubt stems from Depth First Search in division Graph Search of Data Structures & Algorithms II

Answer»

Right answer is (a) Depth First Search

Explanation: This is the definition of the Depth First Search. Exploring a node, then AGGRESSIVELY finding nodes TILL it is not able to FIND any node.



Discussion

No Comment Found

Related InterviewSolutions