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 2 3) (1 (2 3 4) (5 6 7)) (1 (1 (1 1 1) (1 1 1)) (1 1 1)) (1 (2 3) 4) DS go-ds-1 data-structures binary-tree + – Arjun asked Oct 10, 2016 Arjun 466 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
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.. maahisingh answered Oct 16, 2016 maahisingh comment Share Follow See 1 comment See all 1 1 comment reply Sheshang commented Dec 19, 2016 reply Follow Share as in question it is specified that from ABC, only B or C can be null. Now, in (2,3) 2 is root and 3 can be eithe right child or left child of 2 and other child is null. here nowhere mention that tree must have 2 children, so this also a valid binary tree. may be other issue in D option, but not atleast what you have explained 3 votes 3 votes Please log in or register to add a comment.
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) adeemajain answered Oct 8, 2018 adeemajain comment Share Follow See all 0 reply Please log in or register to add a comment.