Depth-first search can spend much time (perhaps infinite time) exploring a very deep path that does not contain a solution, when a shallow solution exists.

An easy way to solve this problem is to put a maximum depth bound on the search. Beyond the depth bound , a failure is generated automatically without exploring any deeper.

** Problems:**

- It's hard to guess how deep the solution lies.
- If the estimated depth is too deep (even by 1) the computer
time used is dramatically increased, by a factor of
*b*.^{extra} - If the estimated depth is too shallow, the search fails to find a solution; all that computer time is wasted.