iHerb interview question

Print all nodes from a given node in a directed graph.

Interview Answer

Anonymous

2 Feb 2019

Depth first search, Breadth First Search, Best First Search, anything will work. Though write the simplest one in the language of your choice: RecursiveDFS(v): ....if v is unmarked ........mark v ........print v ........for each edge vw ............RecursiveDFS(w) It is one of those algorithm problems that I would definitely classify "Very Easy".