/********************************************* * Demonstration program of Merge sorting * * (about n*log(n) comparisons used). * * ------------------------------------------ * * Reference: "A book on C By Al Kelley and * * Ira Pohl, The Benjamin/Cummings Publishing * * Company, Inc, 1984" [BIBLI 09]. * * * * C++ version by J-P Moreau. * * (www.jpmoreau.fr) * * ------------------------------------------ * * SAMPLE RUN: * * * * Initial table A: * * 4 3 1 67 55 8 0 4 -5 37 7 4 2 9 1 -1 * * * * Sorted table A: * * -5 -1 0 1 1 2 3 4 4 4 7 8 9 37 55 67 * * * *********************************************/ #include #define MAXSIZE 1024 //Merge Sorting of a[] of size m and b[] of size n //into c[] of size m+n void Merge(int *a,int *b,int *c,int m,int n) { int i=0,j=0,k=0; while(iMAXSIZE) { printf(" \n\n Error #2: size of array is two bog!\n\n"); *error=2; } } } //mergesort() void main() { int error=0,i,n=16; static int a[] = {4,3,1,67,55,8,0,4,-5,37,7,4,2,9,1,-1}; printf("\n\n Initial table A:\n"); for(i=0; i