Iterative Deepening DFS
The iterative deepening depth-first search is a state space search algorithm, which combines the goodness of BFS and DFS.
- Time complexity: O(b^d), where b is the branching factor and d is the depth of the goal.
- Space complexity: O(d), where d is the depth of the goal.
Pseudocode of IDDFS:
Comparison of DFS, BFS and IDDFS (based on time complexity and space complexity):
The following code block shows the main function of IDDFS:
# recursive function of IDDFS, with parameter depth