@sunny why we look at all k number which are greater then x , correct ? 
Lets think in this way 

we wants to check if kth smallest element in heap thats >=x  isn't it ? so 
if root of mean heap is greater then x then none other elements will less 
then x so we terminate .
else our algorithm  will search children of all the nodes which are less 
then x  till either we have found k of them or we are exhausted e.g. when 
k=0 . so we will cal our function to both left & right children ? 

so now think we are looking for children's of only nodes which are less 
then x and at most k of these in tottal . each have atmost two visited 
childrens so we have visted at-most 3K nodes isn;t it ? for total time O(K) 
? 

let me know where i am wrong ? i am not getting for uy k nodes greater then 
x ? why we will do that & then how much comparisons u needs for that ?



Thanks
Shashank Mani
CSE, BIT Mesra
http://shashank7s.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/lsuMzgEQdMwJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to