I recently implemented DFS and Iterative Deepening algorithms to search for a target node in a tree. Initially I thought I would write my program in C++, however after some thought I decided to go the route of JavaScript. I believe the source code is commented sufficiently to give you a glimpse into some of the decisions I made, therefore I won’t be providing any real detail in this post.

DFS and Iterative Deepening Project

I have to give much thanks to Kirupa, as his ActionScript implementation of DFS and BFS gave me the inspiration to go the route of JavaScript. Not only that, but I was able to use much of his work as a model for the direction I took. I hope you find that I did provide sufficient credit in my comments. Enjoy.

NOTE: I stayed up until 1am, two nights in a row to finish this. I don’t work well late at night and that is likely reflected in some of the algorithmic decisions I made. If you have any questions please don’t hesitate to ask. Also, you might be asking, WTH did he use extjs here? Honestly, I don’t know. I originally had grand visions for my node tree, etc, however those didn’t pan out. In it’s current state there is no advantage to using that framework.