On 8 May, 15:53, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
> In article <8ad43552-b186-4aa9-8688-34e203ff9...@e39g2000hsf.googlegroups.com>,
> Spiros Bousbouras <spi...@gmail.com> wrote:
>
> >I don't think the name "preorder" is very appropriate
> >because one would use it in cases where one might have
> >doubts that the preorder is actually an order. But a tree
> >is actually an order. Best to call your function
> >count_level_nodes or something.
>
> I don't understand your comment, Spiros.
>
> "preorder" is the name of one of the major strategies for
> visiting all nodes of a tree; it involves visiting the leaves
> of a node in left-to-right order, always following all the way down
> the left-most unvisited side before processing any of the nodes further
> right. The code the original poster put up uses preorder traversal
> of a binary tree.
>
> I have not been able to come up with a meaning of "order" that
> would fit with your comment "But a tree is actually an order."
> A tree just *is*; it might perhaps -encode- a command
> ("command" or "instructions" is one meaning of "order"), but
> that would depend upon the -interpretation- of the tree, not upon
> the tree itself.
Oh I see. I was only familiar with the mathematical meaning of
preorder (
http://en.wikipedia.org/wiki/Preorder) I didn't know it
also has a meaning in computer science. In the mathematical
sense a tree is a (partial) order which also makes it a preorder.