1.

A man wants to go different places in the world. He has listed them down all. But there are some places where he wants to visit before some other places. What application of graph can he use to determine that?(a) Depth First Search(b) Breadth First Search(c) Topological Sorting(d) Dijkstra’s Shortest path algorithmI had been asked this question during a job interview.This interesting question is from Topological Sort topic in chapter Miscellaneous of Data Structures & Algorithms II

Answer»

Right choice is (c) TOPOLOGICAL Sorting

Best EXPLANATION: As the definition of topological sorting suggests, it is the way to do tasks in PRESCRIBED ORDER. So, if he does topological sorting, it will be easy for him to recognize what should be the order to visit different PLACES.



Discussion

No Comment Found

Related InterviewSolutions