English Idiom in Unix: Directory Recursively

Chris Angelico rosuav at gmail.com
Wed May 18 14:41:21 EDT 2011


On Thu, May 19, 2011 at 4:20 AM, Raymond Wiker <raw at rawmbp-2.local> wrote:
>> You are right that I assumed parent pointers of some description;
>> but it does demonstrate that tree walks can be done iteratively,
>> without keeping a stack of any sort.
>
>        Except that the chain of parent pointers *would* constitue a
> stack.

Howso? It's part of your data structure, not part of your algorithm;
and it's not something that grows and shrinks as you traverse. These
considerations may be crucial if, for instance, you want to walk your
tree in a signal handler, and you don't know how much memory is
available to you...

Chris Angelico



More information about the Python-list mailing list