0 votes 0 votes Number of comparision in searching an element in a binary search tree is ? DS data-structures binary-search-tree time-complexity gateforum-test-series + – Kashyap Avinash asked Nov 10, 2016 retagged Jul 6, 2022 by Lakshman Bhaiya Kashyap Avinash 346 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 1 votes 1 votes In worst case that's either left or skewed.. searching number may be present at leaf node.. so for worst case it's O(n).. For balanced binary search tree it's O(log n).. kirti singh answered Nov 10, 2016 selected Nov 10, 2016 by Kashyap Avinash kirti singh comment Share Follow See all 3 Comments See all 3 3 Comments reply Kashyap Avinash commented Nov 10, 2016 reply Follow Share but in binary search tree we compare and decide either to go to left child or right and we end with the leaf node if searched key is not present so the answer should be O(log n). I m really confused in this please help me out. 0 votes 0 votes Kashyap Avinash commented Nov 10, 2016 reply Follow Share Ok got it thanks by the way i was ignoring the skewed condition. 0 votes 0 votes kirti singh commented Nov 10, 2016 reply Follow Share Ur wlcm :) 0 votes 0 votes Please log in or register to add a comment.