4 votes 4 votes Here how did we find the number of comparisons for any number. Algorithms data-structures binary-search-tree + – junaid ahmad asked Oct 29, 2017 junaid ahmad 914 views answer comment Share Follow See all 7 Comments See all 7 7 Comments reply saxena0612 commented Oct 29, 2017 reply Follow Share Is it 3.09? 0 votes 0 votes junaid ahmad commented Oct 29, 2017 reply Follow Share Yes.but how did we find the number of comparisons for any number after we construct the BST 0 votes 0 votes saxena0612 commented Oct 29, 2017 reply Follow Share Searching for an element requires traversing every node from root to that particular node so you will compare it with every element in the path.Thus find total comparisons for every node: I got 1*1+2*2+4*3+3*4+1*5=34 [Here first one is no of nodes and second is comparison needed for that. ] Avg:34/11=3.09 4 votes 4 votes junaid ahmad commented Oct 29, 2017 reply Follow Share This is the tree right.so for element 6 and 17 what are the number of comparisons and what are the elements that they compared to. 0 votes 0 votes saxena0612 commented Oct 29, 2017 reply Follow Share Now if you want to search for 9 then sequence would be : 15->6->7->13->9[FOUND] Total comparisons : 5 which is the last element i mentioned in the last comment. 1 votes 1 votes junaid ahmad commented Oct 29, 2017 reply Follow Share Thanks saxena0612 :) 0 votes 0 votes Deepalitrapti commented Jul 2, 2019 reply Follow Share Oky 0 votes 0 votes Please log in or register to add a comment.