|
THURSDAY, JUNE 17, 2010
Graph Traversal
If you change a graph traversal algorithm from stack-based to queue-based, you change it from depth-first to breadth-first.
Breadth-first is useful when you want to process siblings before processing their children. Depth-first traversal processes as deep as it can before backtracking. Interesting note: although this is clearly a use for recursion, either method can be implemented iteratively to save space on the stack (and sidestep potential stack overflow issues when there are many nodes).
Posted by Chet at 3:17 PM
Comments
No Comments have been Posted.
Post a Comment
Feel Free To Share Your Thoughts
You can use [b], [u], [i], and [url] |