33 votes 33 votes Consider the following nested representation of binary trees: $(X \ Y \ Z)$ indicates $Y$ and $Z$ are the left and right subtrees, respectively, of node $X$. Note that $Y$ and $Z$ may be $NULL$, or further nested. Which of the following represents a valid binary tree? $(1 \ 2 \ (4 \ 5 \ 6 \ 7))$ $(1 \ (2 \ 3 \ 4) \ 5 \ 6) \ 7)$ $(1 \ (2 \ 3 \ 4) \ (5 \ 6 \ 7))$ $(1 \ (2 \ 3 \ NULL) \ (4 \ 5))$ DS gatecse-2000 data-structures binary-tree easy + – Kathleen asked Sep 14, 2014 edited Dec 24, 2017 by kenzou Kathleen 10.9k views answer comment Share Follow See 1 comment See all 1 1 comment reply raja11sep commented Jan 20, 2022 reply Follow Share If we modify B like this (1 ( ( 234 ) 5 6 ) 7 ) then also It will be invalid. 0 votes 0 votes Please log in or register to add a comment.
3 votes 3 votes So answer is C Caption IamDRD answered Dec 1, 2019 IamDRD comment Share Follow See all 0 reply Please log in or register to add a comment.
2 votes 2 votes We can only construct from C option so c is answer Rishi yadav answered Oct 4, 2017 Rishi yadav comment Share Follow See all 0 reply Please log in or register to add a comment.
2 votes 2 votes Ans: C valid binary tree rishu_darkshadow answered Oct 9, 2017 rishu_darkshadow comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Main observation - We can easily see that in XYZ, X = root, Y = left sub tree, Z = right sub tree. Therefore inorder form. (#($)(%)) --> bracket sequence Hence option C. SaumyaSharma answered Oct 31, 2022 SaumyaSharma comment Share Follow See all 0 reply Please log in or register to add a comment.