A non-recursive implementation of DFS with worst-case space complexity O(|E|):1 procedure DFS-iterative(G,v): 2 let S be a stack 3 S.push(v) 4 while S is not empty 5 v = S.pop() 6 if v is not labeled as discovered: 7 label v as discovered 8 for all edges from v to w in G.adjacentEdges(v) do 9 S.push(w) - Study24x7
Social learning Network
19 Mar 2019 11:58 AM study24x7 study24x7

A non-recursive implementation of DFS with worst-case space complexity O(|E|):1 procedure DFS-iterative(G,v): 2 let S be a stack 3 S.push(v) 4 while S is not empty 5 v = S.pop() 6 if v is not labeled as discovered: 7 label v as disco...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles