二叉树遍历

2018-06-16  本文已影响0人  gzxultra

二叉树的遍历分为深度优先遍历(Depth First Traversal)和广度优先遍历(Breath First Traversal also called Levelorder Traversal)。其中深度优先遍历又分为先序遍历(Preorder Traversal),中序遍历(Inorder Traversal)和后续遍历(Postorder Traversal)。

Pre-order Traversal

Visit the root, traverse the left subtree, traverse the right subtree.

In-order Traversal

Traverse the left subtree, visit the root, traverse the right subtree.

Post-order Traversal

Traverse the left subtree, traverse the right subtree, visit the root.

上一篇下一篇

猜你喜欢

热点阅读