Here, I've presented the merge sort algorithm as the straight merge sort. The basic idea is to break the file into n subfiles of size 1 and merge adjacent disjoint pairs of files and repeating the process until we've single file remaining of size n.
The C Source codes is as follows:
The C Source codes is as follows:
// Merge sort implementation in C
#include<stdio.h>
void getdata(int arr[],int n)
{
int i;
printf("\nEnter the data:");
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
}