Tree Walking

Additional example

Comments are moderated. It may take a few minutes before your comment appears.
Markdown is supported in your comments.

This is specifically about the claim that Python's 1000 deep recursion limit makes it impossible to walk unbalanced trees. There are simple and pythonic ways to iterate over trees, and I will illustrate one. I greatly prefer this to the typical tree recursion process. It is actually similar to BFS in Lisp. With one slight modification you can process a tree either breadth-first or depth-first, switching dynamically between the two at run time based on the contents of a node. It can also be adapted to walk cyclic graphs.

Mail: (not shown)

Please type this: