English Idiom in Unix: Directory Recursively
Hans Georg Schaathun
hg at schaathun.net
Wed May 18 14:11:29 EDT 2011
["Followup-To:" header set to comp.lang.python.]
On 18 May 2011 09:16:26 -0700, Thomas A. Russ
<tar at sevak.isi.edu> wrote:
: Well, unless you have a tree with backpointers, you have to keep the
: entire parent chain of nodes visited. Otherwise, you won't be able to
: find the parent node when you need to backtrack. A standard tree
: representation has only directional links.
The array representation of a binary tree is standard, and the
«back» (parent) pointers are mathematically given. /Some/
standard tree representation do not have parent pointers.
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.
--
:-- Hans Georg
More information about the Python-list
mailing list