Lesson6 Trees
Lesson6 Trees
Access the tree from A, and following in-order traversal, we move to its left
subtree B.
B is also traversed in-ordered. And the process goes on until all the nodes are
visited.The output of in-order traversal of this tree will be −
D → B → E →A → F → C → G
ALGORITHM: INORDER TRAVERSAL
PREORDER TRAVERSAL
In this traversal method, the root node is visited first, then
left subtree and finally right sub-tree.
CONT.…
We start from A, and following pre-order traversal, we first visit left subtree B.
B is also traversed post-ordered. And the process goes on until all the nodes are
visited.The output of post-order traversal of this tree will be −
D → E → B → F → G → C →A
ALGORITHM: POSTORDER TRAVERSAL