Are there any advantages to writing a BFS tree-traversal algorithm recursively vs iteratively? It seems to me iterative is the way to go since it can be implemented in a simple loop:
- Enqueue root node
- Dequeue node and examine
- Enqueue its children
- Go to step 2
Is there any advantage to recursion? It seems more complex with no advantages.
Thanks in advance...