936 views
1 1 vote

Consider the following nested representation of Binary Trees.

$(ABC)$ indicates $B$ and $C$ are left and right subtrees of node $A$ respectively. Note that $B$ and $C$ may be NULL or further nested.

Which of the following representation is not a valid Binary tree?    
 

  1. (1 2 3)  
  2. (1 (2 3 4) (5 6 7))         
  3. (1 (1 (1 1 1) (1 1 1)) (1 1 1))     
  4. (1 (2 3) 4)

2 Answers

1 1 vote
in option d we have (2 3).. we do not know which is the middle element and binary tree is not defined for such case in the question.

all other options do not have any such case..
0 0 votes

Option D should also be correct as (2 3) means root = 2 , left child= 3 , right child = null so writing (2 3 null) is same as writing (2 3)

1 flag:
✌ Edit necessary (solar_raven)
Answer:
Position:
Show:

Related questions

7 7 votes
5 answers 5 answers
2.6k
2.6k views
Arjun asked Oct 10, 2016
2,594 views
A program takes as input a binary tree (not necessarily balanced) with $n$ nodes and computes for each node, the no. of leaf nodes in the sub-tree rooted at that node. Th...
0 0 votes
1 answers 1 answer
596
596 views
Arjun asked Oct 10, 2016
596 views
Consider the array given below:20 10 9 8 7 6 5It isa full binary tree in array representationa complete binary tree in array representationa max-heap in array representat...
2 2 votes
2 answers 2 answers
1.6k
1.6k views
Arjun asked Oct 10, 2016
1,637 views
With 5 distinct nodes, the maximum no. of binary trees that can be formed is _____
2 2 votes
3 answers 3 answers
2.5k
2.5k views
Arjun asked Oct 10, 2016
2,500 views
Which of the following statements is false?A tree with $n$ nodes has $n-1$ edgesA labeled rooted binary tree can be uniquely constructed given its in-order and pre-order ...