0 votes 0 votes DS data-structures binary-search-tree ace-test-series + – ashish pal asked Dec 21, 2017 edited Mar 7, 2019 by Rishi yadav ashish pal 565 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Ashwin Kulkarni commented Dec 21, 2017 reply Follow Share When storing binary tree into an array, If parent is at ith position then its children will be at 2i and 2i+1 positions. Hence 20 is parent of 40, hence at index 1 =20, index 2= 10, index 3= 40 0 votes 0 votes hs_yadav commented Dec 21, 2017 reply Follow Share it depends on either root index is 0 or 1.... if 0:=left 2*i+1 right: 2*i+2 root (i) if 1:= left 2*i roght:2*i+1 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Question should explicitly mention in which structure you are storing the tree. Assuming its an array with start index 0. The answer is 2. If with index 1. The answer is 3. Karan Saini answered Dec 21, 2017 Karan Saini comment Share Follow See all 0 reply Please log in or register to add a comment.