int median(int arr1[],int arr2[],int N)
{
if(N==2)
{
return ((max(arr1[0],arr1[1])+ min(arr2[0],arr2[1]))/2);
}
int mid=N/2;
if(arr1[mid]==arr2[mid])
return arr1[mid];
if(arr1[mid]>arr2[mid])
return median(arr1,arr2+N/2,N-N/2);
if(arr1[mid]<arr2[mid])
return median(arr1+N/2,arr2,N-N/2);
}
correct me if it is wrong......
--
Regards,
Manish Kumar
MCA 3rd Year
IIT Roorkee
--
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.