Re: [algogeeks] Re: Median Finding in Sorted Arrays

2014-01-09 Thread Don
http://www.geeksforgeeks.org/median-of-two-sorted-arrays-of-different-sizes/ This gives a reasonable solution. However, I would use iteration instead of tail recursion. Don On Monday, January 6, 2014 4:15:41 AM UTC-5, atul007 wrote: @dave : could you provide pseudo code for ur approach On 6

Re: [algogeeks] Re: Median Finding in Sorted Arrays

2014-01-06 Thread atul anand
@dave : could you provide pseudo code for ur approach On 6 Jan 2014 07:39, Dave dave_and_da...@juno.com wrote: Use a binary search. Assume that you have arrays a[m] and b[n] sorted in ascending order. If a[i] is the kth smallest element, then b[k-i-2] must be smaller than a[i], and b[k-i-1]

[algogeeks] Re: Median Finding in Sorted Arrays

2014-01-05 Thread Dave
Use a binary search. Assume that you have arrays a[m] and b[n] sorted in ascending order. If a[i] is the kth smallest element, then b[k-i-2] must be smaller than a[i], and b[k-i-1] must be larger (assuming arrays are zero-based). After using a binary search to find the value of i to meet this