1. Preorder, postorder
  2. Postorder, inorder
  3. Postorder, preorder
  4. None of these
6 views

1 Answers

Option 4 : None of these

Tree 1:

PRE ORDER: A B D E G H I J F C

IN ORDER:   B G E H I J D F A C

POST ORDER: G J I H E F D B C A

Tree 2:

PRE ORDER: G F E I J H C D B A

IN ORDER: G J I H E F B D C A F

POST ORDER: J H I E B D A C F G

Therefore, no match possible, and hence the answer is option 4.

// it has been modified since all the options are incorrect

 

Types of traversal and the recursive call

Preorder Traversal

prinftf(root->val)

preorder(root->left)

preorder(root->right)

Inorder Traversal

preorder(root->left)

prinftf(root->val)

preorder(root->right)

Post Traversal

preorder(root->left)

preorder(root->right)

prinftf(root->val)

6 views

Related Questions