@maxim . my algo is for array of equal sizes.Sorry I didn't notice the unequal thing.
On Tue, Aug 17, 2010 at 10:09 AM, Maxim Mercury <[email protected]>wrote: > above algo isnt handling unequal length arrays, > > On Aug 13, 10:06 pm, Nikhil Agarwal <[email protected]> wrote: > > Check this code > > > > int med1,med2; > > void func(int a[], int x1, int x2, int b[], int y1, int y2){ > > int midx,midy; > > if((y2-y1+1)==2) > > { > > med1=max(a[x1],b[y1]); > > med2=min(a[x2],b[y2]); > > return;} > > > > midx=(x1+x2)/2; > > midy=(y1+y2)/2; > > if(a[midx]>b[midy]){ > > x2=x2-(midy-y1); > > y1=midy; > > }else{y2=y2-(midx-x1); > > x1=midx;} > > > > func(a,x1,x2,b,y1,y2); > > > > } > > > > med1 and med2 are two medians. > > > > > > > > -- > 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]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Thanks & Regards Nikhil Agarwal Senior Undergraduate Computer Science & Engineering, National Institute Of Technology, Durgapur,India http://tech-nikk.blogspot.com http://beta.freshersworld.com/communities/nitd -- 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.
