Let's say you have two arrays: A[x] and B[y]. The median is the (x+y)/
2th value. If A[i] is the median, then B[(x+y)/2-i] <= A[i] and B[(x
+y)/2-i+1] >= A[i].
So you can use a binary search to find the point where that condition
occurs. Of course you want to search on the smaller array.
You'll need some logic at the end to determine if the median is in A
or in B.
Don

On Sep 1, 10:31 am, Ankur Garg <[email protected]> wrote:
> Can anybody explain logic ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to