as all the elements are sorted in the array make a min heap of the
array elements and as min heap is a tree of keys querying a min heap
or a binary search tree requires operations with time equal to the
height of the tree which is log(n) hence time for querying a min heap
for an operation will in general be like

if(index==key)
print"success";

else
continue;

which is an O(logn) solution any mistakes are always welcomed

Thanx

On Dec 4, 3:23 pm, bittu <shashank7andr...@gmail.com> wrote:
> find out all the elements in a sorted integer array whose value is
> equal to index of the array. O(logn) solution is expected.
>
> Regards
> Shashank

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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