Pre-order Traversal 前序遍历
Pre-order traversal is to visit the root first. Then traverse the left subtree. Finally, traverse the right subtree.
In-order Traversal 中序遍历
In-order traversal is to traverse the left subtree first. Then visit the root. Finally, traverse the right subtree.
Post-order Traversal 后序遍历
Post-order traversal is to traverse the left subtree first. Then traverse the right subtree. Finally, visit the root.
Recursive or Iterative //递归和迭代
Try to practice the three different traversal methods in our after-article exercise. You might want to implement the methods recursively or iteratively. Implement both recursion and iteration solutions and compare the differences between them.
我的理解:不管是怎么样的遍历,都是从左到右的普遍规则,这里所谓的 前、中、后,都是指root(根),
前:访问每个二叉树时,根第一个去访问,
中:访问二叉树的时候,根是第二个去访问
后:访问每个二叉树时,根是最后一个去访问