From Algorithm Wiki
Revision as of 06:20, 3 January 2017 by Joky
- For BFS, queues are used.
- For DFS, stacks are used. The use of recursion is using the language-managed stack to store the intermediate state in place of an explicit stack. However since in practice the size of the stack is limited, robustness dictates to use an explicit stack for any real-world program that needs to deal with an unbounded maximum depth recursion.