#include #include #include #include #include #include #define MAX 50000 using namespace std; void mergeSort(int arr[],int low,int mid,int high); void partition(int arr[],int low,int high); int main() { double time_spent; clock_t begin,end; int merge[MAX],i,n,index=0; FILE* file = fopen ("data.txt", "r"); int x = 0,count=0; fscanf (file, "%d", &x); while (!feof (file)) { merge[index]=x; index++; fscanf (file, "%d", &x); } printf("\nCount: %d\n",index); fclose(file); n=index; begin=clock(); partition(merge,0,n-1); end=clock(); time_spent=(double)(end-begin)/CLOCKS_PER_SEC; printf("\nThe difference is: %f seconds\n",time_spent); FILE *f; f = fopen("output_normal_merge_sort.txt", "w"); printf("After merge sorting elements saved to output_normal_merge_sort.txt "); for(i=0; imid) { for(k=m; k<=high; k++) { temp[i]=arr[k]; i++; } } else { for(k=l; k<=mid; k++) { temp[i]=arr[k]; i++; } } for(k=low; k<=high; k++) { arr[k]=temp[k]; } }