0 votes 0 votes Identify the correct sequence for searching 105 in a binary search tree? a. 500,250,190,220,150,120,105 b. 80,800,500,90,270,280,105 c. 20,30,80,200,90,120,105 d. 30,50,80,200,90,120,105 Plz help me. DS data-structures binary-search-tree + – mystylecse asked Oct 4, 2017 • recategorized Jun 23, 2022 by Lakshman Bhaiya mystylecse 1.4k views answer comment Share Follow See all 8 Comments See all 8 8 Comments reply Show 5 previous comments mystylecse commented Oct 5, 2017 reply Follow Share They are asking which of them is correct sequence. 0 votes 0 votes sachin! commented Oct 5, 2017 i edited by sachin! Oct 5, 2017 reply Follow Share ONLY c d 0 votes 0 votes mystylecse commented Oct 5, 2017 reply Follow Share Can you please explain only b option why it is correct sequence? 0 votes 0 votes Please log in or register to add a comment.
Best answer 2 votes 2 votes Searching in a BST always starts at the root. We compare a data stored at the root with the key we are searching for. If the node does not contain the key we proceed either to the left or right child depending upon the comparison. If the result of the comparison is negative we go to the left child, otherwise - to the right child. You need to check the following conditions: (i) The left sub-tree of a node contains only nodes with keys less than the node's key. (ii) The right sub-tree of a node contains only nodes with keys greater than the node's key. Options C and D are correct sequences for 150. LeenSharma answered Oct 5, 2017 • edited Oct 5, 2017 by LeenSharma LeenSharma comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments LeenSharma commented Oct 5, 2017 reply Follow Share I think all B,C, and D are the correct searching sequence.Why are you saying only C and D right?Please prove your point. 0 votes 0 votes Warlock lord commented Oct 5, 2017 reply Follow Share In B) 105 is on the right tree of 270. Is 105>270? 0 votes 0 votes LeenSharma commented Oct 5, 2017 reply Follow Share yes, Thank you for correcting. 0 votes 0 votes Please log in or register to add a comment.