Write the psuedo code for the Depth first Search.
C++ programming on UNIX, C++ Networking,C++ Algorithm Questions and Answers
(Continued from previous question...)
Write the psuedo code for the Depth first Search.
dfs(G, v) //OUTLINE
Mark v as "discovered"
For each vertex w such that edge vw is in G:
If w is undiscovered:
dfs(G, w); that is, explore vw, visit w, explore from there
as much as possible, and backtrack from w to v.
Otherwise:
"Check" vw without visiting w.
Mark v as "finished".
(Continued on next question...)
Other Interview Questions
|