above algo isnt handling unequal length arrays,

On Aug 13, 10:06 pm, Nikhil Agarwal <nikhil.bhoja...@gmail.com> 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 algoge...@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