Use a binary search.

If you have arrays a[n] and b[m], then if you claim that a[i] is the
kth largest element, then b[k-i-2] must be larger than a[i], and b[k-
i-1] must be less (assuming arrays are zero-based). After using a
binary search to find the value of i to meet this condition, you have
to determine if a[i] or b[k-i-1] is the final answer.

Don

On Jan 30, 1:45 pm, Ashish Goel <ashg...@gmail.com> wrote:
> Hi,
>
> I am trying to write code for this problem but having issues.
> Can you help
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
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