534 views
1 votes
1 votes

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 votes
1 votes
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 votes
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)

Answer:

Related questions

1.3k
views
5 answers
6 votes
Arjun asked Oct 10, 2016
1,279 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. The ... $\Theta\left(n^2 \log n \right)$
336
views
1 answers
0 votes
Arjun asked Oct 10, 2016
336 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 representationall of the above
898
views
2 answers
1 votes
Arjun asked Oct 10, 2016
898 views
With 5 distinct nodes, the maximum no. of binary trees that can be formed is _____
1.2k
views
3 answers
2 votes
Arjun asked Oct 10, 2016
1,232 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 ... $h$ is the maximum distance of a node from root.