in DS edited by
2,209 views
10 votes
10 votes

Let $T$ be a rooted binary tree whose vertices are labelled with symbols $a, b, c, d, e, f, g, h, i, j, k$. Suppose the in-order (visit left subtree, visit root, visit right subtree) and post-order (visit left subtree, visit right subtree, visit root) traversals of $T$ produce the following sequences.

in-order:$a, b, c, d, e, f, g, h, i, j, k$

post-order:$a, c, b, e, f, h, j, k, i, g, d$

How many leaves does the tree have?

  1. THREE.
  2. FOUR.
  3. FIVE.
  4. SIX.
  5. Cannot be determined uniquely from the given information.
in DS edited by
2.2k views

2 Answers

14 votes
14 votes
Best answer

We can construct binary tree by postorder and inorder traversal

There we get $5$ leaves of the tree  are $a,c,e,h,j$

So, answer (C) $5$

edited by
9 votes
9 votes

There are 5 leaves as shown in below fig.

Answer:

Related questions