let the total sum of the lengths of the two array is 'Len'
Median is Len/2 (if the two arrays are combined and sorted)

int count=0,i=0,j=0;

while(count<(Len/2))
{

if(arr1[i]<arr2[j])
i++;
else
j++;
count++;
}

if(arr1[i]<arr2[j])
arr1[i]=median
else
arr2[j]=median

On Thu, Sep 1, 2011 at 9:01 PM, Ankur Garg <ankurga...@gmail.com> 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 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.
>



-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

-- 
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