Chetan Angadi
BAN USERint Merge(int a[], int b[], int m, int n)
{
/*Worst case is O(k). where k is n+m
k is length of array B, m is no of elements in array A, n is
no of elements in array b */
int i=m, j = n;
int k = b.length;
while(k>=0 && i>=0)
{
if(b[j] < a[i]){
b[k] = a[i]
i--; k--;
}
else
{
b[k] = b[j];
k--; j--;
}
}
}
- Chetan Angadi October 10, 2012