Binary Tree Traversal

Binary Tree的三种Traversal方法老是记混,故于此总结下。

Preorder: Node -> Left subtree -> Right subtree

Inorder: Left subtree -> Node -> Right subtree

Postorder: Left subtree -> Right subtree -> Node

Pre, In, Post指的是Node本身在[Node, Left, Right]中被访问的顺序。Pre is 1st, In is 2nd, Post is 3rd.

Note: Inorder traversal of a BST would produce a strictly increasing list of integers.

posted @ 2014-04-10 03:08  门对夕阳  阅读(108)  评论(0编辑  收藏  举报