int* mergeList(int a[], int aSize, int b[], int bSize)
{
   int   k, i = 0, j = 0;
   int   *newList;
   newList = (int*)malloc((aSize + bSize)*sizeof(int));
  
   if (newList != NULL)
   {
      for (k = 0; k < aSize + bSize; k++)
      {
         if (i == aSize) {newList[k] = b[j]; j++;}
         else if (j == bSize) {newList[k] = a[i]; i++;}
         else if (a[i] <= b[j]) {newList[k] = a[i]; i++;}
         else {newList[k] = b[j]; j++;}
      }
    }
    else { fprintf(stderr, “Out of Memory\n”); exit(1); }
    return newList;
}