Only Balanced BST (its guaranteed that we can search element in o(logn) , 

i am assuming its maxheap .In a max heap, the smallest element is always 
present at a leaf node. So we need to check for all leaf nodes for the 
minimum value. Worst case complexity will be O(n)

12
/ \
/ \
8 7
/ \ / \     try to search 5 in this using Heap & balanced BST 
/ \ / \
2 3 4 5

As searching is main constraints on complexity we can't use Heap to achieve 
O(logn) it will take linear time but using Balanced BST (e.g. AVL/RB Tree) 
we can search element in O(logn) :)


Shashank 
CSE,BIT Mesra

-- 
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/-/fmXlF2-kcFwJ.
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