Question 48

For the following binary tree inorder traversal yields the expression :

For the following binary tree inorder traversal yields the expression : Binary tree: root is '−'; its left child is '+' and its right child is '/'. '+' has left child 'a' and right child '*'; '*' has children 'b' (left) and 'd' (right). '/' has children 'e' (left) and 'f' (right).
  1. A− + * / abdef
  2. Ba + bd * − ef /
  3. Cabdef* / + −
  4. Da + b * d − e/f
Show answerHide answer

Correct answer: (D) a + b * d − e/f

Explanation

Inorder traversal visits left subtree, root, then right subtree. Left subtree gives a + b * d, then the root −, then the right subtree e / f, giving a + b * d − e/f.

From DSSSB TGT Computer Science Practice Set 1

This is question 48 of DSSSB TGT Computer Science Practice Set 1. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.