Jump to content

Talk:Pre-order traversal

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by MZMcBride (talk | contribs) at 01:45, 29 August 2013 (bug!). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Not too clear, this one...

Yeh, I'll try to add some more detail to it.


As described this can surely only refer to binary trees, and this is, I think, the normal usage. However, if a tree is defined in terms of nodes, and list of trees - something like ...

e.g

data Tree a = Node a | (Node a, [ Tree a])

.... you might prefer
   data Tree a = EmptyTree| (Node a, [ Tree a])


then the generalisation would be to recursively visit the node first, followed by each tree in the list in list order. Postorder could be defined in a similar fashion, but inorder would then be meaningless.

Someone might want to clarify this. I suspect that most functional programming practitioners would be happy with the generalisations.

David Martland 11:03 Apr 8, 2003 (UTC)