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.

你可能感兴趣的:(binary)