Consider the following expression tree. In-order, pre-order and post-order…

2022

Consider the following expression tree. In-order, pre-order and post-order traversal of this tree will result into which of the following expressions, respectively?

image.png
  1. A.

    In-order: a + b c *
    Pre-order: + a * b c
    Post-order: a b c * +

  2. B.

    In-order: a b + * c
    Pre-order: + a * b c
    Post-order: a b c * +

  3. C.

    In-order: a + b * c
    Pre-order: + a * b c
    Post-order: a b c * +

  4. D.

    In-order: a * b + c
    Pre-order: + a * b c
    Post-order: a b c * +

Attempted by 723 students.

Show answer & explanation

Correct answer: C

The expression tree has root +, left child a, and right child * with children b and c.

In-order (Left-Root-Right): a + b * c
Pre-order (Root-Left-Right): + a * b c
Post-order (Left-Right-Root): a b c * +

Therefore, the correct option is the one that lists all three traversals in this order.

Explore the full course: Up Lt Grade Assistant Teacher 2025