A binary search tree contains the numbers 1, 2, 3, 4, 5, 6, 7, 8. When the…

GATE · 2005 · IT

A binary search tree contains the numbers 1, 2, 3, 4, 5, 6, 7, 8. When the tree is traversed in pre-order and the values in each node printed out, the sequence of values obtained is 5, 3, 1, 2, 4, 6, 8, 7. If the tree is traversed in post-order, the sequence obtained would be  

  1. A.

    8, 7, 6, 5, 4, 3, 2, 1

  2. B.

    1, 2, 3, 4, 8, 7, 6, 5

  3. C.

    2, 1, 4, 3, 6, 7, 8, 5

  4. D.

    2, 1, 4, 3, 7, 8, 6, 5

Attempted by 287 students.

Show answer

Correct answer: D

The worked solution is available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…