It\'s been quite a while since I took data structures and algorithms in college, so I was surprised recently by a suggestion that recursion may not be the w
If you have a fixed amount of memory dedicated to the stack, as you often do (this is especially a problem in many Java JVM configurations), recursion may not work well if you have a deep tree (or if recursion depth is high in any other scenario); it will cause a stack overflow. An iterative approach, pushing nodes to visit onto a queue (for BFS-like traversal) or stack (for DFS-like traversal) has better memory properties in several ways, so if this matters, use an iterative approach.
The advantage of recursion is simplicity/elegance of expression, not performance. Remembering that is the key to choosing the appropriate approach for a given algorithm, problem size, and machine architecture.