Maintain a pointer A_end = m-1;
doing a comparision something similar to merge sort

int i=0;j=0;
while (i< m){
 if (a[i] < b[j])
  i++;
 else{
  swap(a[A_end],b[j])
  A_end --;
  j++;
 }
}

This runs in O(m) time and no extra space, also the sort order is not 
guarenteed.

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