tree - Non recursive Depth first search algorithm - Stack Overflow
I am looking for a Non recursive Depth first search algorithm for a non binary tree. Any help is very much appreciated. ... If you have pointers to parent nodes, you can do it without additional memory. def dfs(root): node = root while True: visit(node) i...