For the following binary tree, inorder traversal yields the expression:

2017

For the following binary tree, inorder traversal yields the expression:

image.pngimage.png
  1. A.

    − + * abde f

  2. B.

    a + b d *− ef/

  3. C.

    abdef* / + −

  4. D.

    a + b * d − e / f

Attempted by 742 students.

Show answer & explanation

Correct answer: D

Solution: Inorder traversal (left, root, right)

  1. Visit the left subtree of the root (the subtree with '+' as root).

  2. In that subtree, visit its left child: a

  3. Then visit the '+' node itself, appending + to the expression.

  4. Now visit the right subtree of '+' which is the '*' node: visit its left child b, then '*' (*), then its right child d. This yields "b * d" for that subtree.

  5. Combining the left subtree gives: a + b * d

  6. Visit the root node - and append it.

  7. Finally visit the right subtree (the '/' node): visit left child e, then '/' (/), then right child f. This yields "e / f".

Final inorder expression: a + b * d - e / f

Explore the full course: Up Lt Grade Assistant Teacher 2025