Iterative Depth First Search

When you are aware the solution will be at or near a particular level and you would like the advantages of the small memory requirement of DFS, you just do a normal DFS, but limit it to a certain node depth.


Kinda fast, little memory requirement


You must know that the solution is at a certain level. This depends quite heavily on the problem


Quite similar to the DFS implementation in case it has not been done yet.

Java implementation

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License