function out = merge(A, B)
 if length(A)==0
     out = B;
 elseif length(B) == 0
     out = A;
 else
     if A(1) <= B(1)
         temp =A(1);
         out = [temp, merge(A(2:end),B)];
     else
         temp = B(1);
         out = [temp, merge(A,B(2:end))];
     end;
 end;
         