It is implemented in recursion with LIFO stack data structure. It creates the same set of nodes as Breadth-First method, only in the different order.
As the nodes on the single path are stored in each iteration from root to leaf node, the space requirement to store nodes is linear. With branching factor b and depth as m, the storage space is bm.
Disadvantage: This algorithm may not terminate and go on infinitely on one path. The solution to this issue is to choose a cut-off depth. If the ideal cut-off is d, and if chosen cutoff is lesser than d, then this algorithm may fail. If chosen cut-off is more than d, then execution time increases.
Its complexity depends on the number of paths. It cannot check duplicate nodes.
- Everything You Need to Know About Proxies: What and When to Use It - January 20, 2021
- 7 Top Tips To Create A Stand Out Freelancer Profile - January 18, 2021
- 5 Mistakes Graphic Designers Make When Starting Out — And How to Avoid Them - January 11, 2021