Experiment 11 Merge Sort
Experiment 11 Merge Sort
/*Design and implement C/C++ Program to sort a given set of n integer elements using Merge Sort
method and compute its time complexity. Run the program for varied values of n> 5000, and
record the time taken to sort. Plot a graph of the time taken versus n. The elements can be read
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int i, j, k, b[100000];
i = low;
j = mid + 1;
k = low;
b[k++] = a[i++];
else
b[k++] = a[j++];
b[k++] = a[i++];
b[k++] = a[j++];
a[k] = b[k];
}
void MergeSort(int a[], int low, int high) {
int mid;
return;
void main() {
int n, k;
double ts;
scanf("%d", &n);
a[k]=rand();
printf("%d\t",a[k]);
st = clock();
MergeSort(a, 0, n - 1);
et = clock();
printf("%d\t", a[k]);
}