0
2.6kviews
Traverse the binary tree into preorder, inorder and postorder by giving its algorithm.

enter image description here

1 Answer
0
35views

The preorder tree traversal’s algorithm is:-

Visit the node.

Traverse the left subtree.

Traverse the right subtree.

The inorder tree traversal’s algorithm is:-

Traverse the left subtree

Visit the node.

Traverse the right subtree.

The postorder tree traversal’s algorithm is:-

Traverse the left subtree.

Traverse the right subtree.

Visit the node.

The preorder traversal is: A-B-D-E-H-I-C-F-G

The inorder traversal is: D-B-H-I-E-A-C-G-F

The postorder traversal is: D-I-H-E-B-G-F-C

Please log in to add an answer.