39 39 votes The following numbers are inserted into an empty binary search tree in the given order: $10, 1, 3, 5, 15, 12, 16$. What is the height of the binary search tree (the height is the maximum distance of a leaf node from the root)? $2$ $3$ $4$ $6$ Data Structures gatecse-2004 data-structures binary-search-tree easy isro2009 + – Kathleen 29.7k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 54 54 votes Height is 3 Correct Answer: $B$ Prashant. answered Nov 15, 2015 • edited Jul 7, 2019 by Lakshman Bhaiya Prashant. comment Share Follow See all 11 Comments 11 11 Comments reply Show 8 previous comments Swiss commented Oct 6, 2021 reply Follow flag They did not tell us to balance it. Balancing is carried out if it is mentioned that it is an AVL tree. 0 0 replyShare KhushiRastogi commented Jan 5, 2023 reply Follow flag because they are not saying to balance , they have not even mentioned the word in thewhole question . in gate pyq the answer is “ only for exactly what is asked “ 0 0 replyShare Tushar Rana commented Jan 5, 2025 reply Follow flag @KhushiRastogi but why a BST even be balanced. Isn't AVL a completely different category of trees for them 0 0 replyShare Please log in or register to add a comment.
10 10 votes ans is (b) kvkumar answered Jun 26, 2016 kvkumar comment Share Follow See all 2 Comments 2 2 Comments reply s_dr_13 commented Jul 17, 2020 reply Follow flag what tool did you use bro to draw this ? Kinda curious 0 0 replyShare rhl commented Sep 21, 2021 reply Follow flag This https://www.cs.usfca.edu/~galles/visualization/BST.html 2 2 replyShare Please log in or register to add a comment.
6 6 votes Ans) 3 Draw a BST for the given numbers And the Distance from root(i.e 10) to leaf(i.e 5) is 3. Prasanna answered Nov 15, 2015 Prasanna comment Share Follow 0 reply Please log in or register to add a comment.
5 5 votes ans will be 3 . hence option (b) anonymous answered Dec 21, 2014 anonymous comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Height is 3 Vasudevarnab_das answered Mar 18, 2023 Vasudevarnab_das comment Share Follow 0 reply Please log in or register to add a comment.
–3 –3 votes Why not height at root considered as 0 As per that the height is 2 Please correct me Swami patil answered Dec 4, 2017 1 flag: ✌ Edit necessary (Tushar Rana “It's a doubt not an answer”) Swami patil comment Share Follow See 1 comment 1 1 comment reply Puja Mishra commented Dec 23, 2017 reply Follow flag Read definition of height of tree ... which is # of longest edges from root to leaves .... and height of node ... which is # of longest edges from that node to leaves .... 5 5 replyShare Please log in or register to add a comment.