Consider two array arr_a[] and arr_b[]. Suppose Number of elements in arr_a[] are n and number of elements in arr_b[] are m. size of arr_a[] is n and size of arr_b[] is m.
MergeInPlace(int arr_a[], int arr_b[],int n,int m) { int a =0;b=0,k=0,key=0; for(;b<m;b++){ for(;a<n;a++){ if(arr_b[b] < arr_a[a]){ key = arr_b[b]; k=b; while(k>0){ arr_b[k] = arr_b[k-1]; k--; } arr_b[0] = arr_a[n-1]; k =n-1; while(k>=a){ arr_a[k] = arr_a[k-1]; k--; } arr_a[a] = key; break; } } -- 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.