Show your tracing based on the algorithm given below. Use the following table to show your tracing.
dfs(in v:Vertex) begin
s.createStack(v)
s.push(v)
Mark v as visited
while (!s.isEmpty()) {
if (no unvisited vertex are adjacent to the vertex on the top of the stack)
s.pop() else
select an unvisited vertex u adjacent to the vertex on the top of the stack
s.push(u)
mark u as visited endif
endWhile
The depth-first search algorithm
node visited
w/u
Queue/stack
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here