Professional Documents
Culture Documents
#include<stdio.h>
#include<conio.h>
#define SIZE 6
int arr[SIZE];
void merg_sort(int[],int,int);
void merg_pass(int[],int,int,int);
void main()
int i,l,h;
printf("enter values");
for(i=0;i<SIZE;i++)
scanf("%d",&arr[i]);
l=0;
h=SIZE-1;
merg_sort(arr,l,h);
for(i=0;i<SIZE;i++)
printf("%d\t",arr[i]);
getch();
int mid;
if(l!=h)
Rachit Aggrawal(0809113056)
mid=(l+h)/2;
merg_sort(arr,l,mid);
merg_sort(arr,mid+1,h);
merg_pass(arr,l,mid,h);
int r,s,f,t,i,temp[100];
f=bottom;
r=size;
t=bottom;
s=size+1;
while(f<=r&&s<=upper)
if(arr[f]<arr[s])
temp[t]=arr[f];
f++;
else
temp[t]=arr[s];
s++;
t++;
Rachit Aggrawal(0809113056)
}
for(f=f;f<=r;f++)
temp[t]=arr[f];
t++;
for(s=s;s<=upper;s++)
temp[t]=arr[s];
t++;
for(i=bottom;i<=upper;i++)
arr[i]=temp[i];
Rachit Aggrawal(0809113056)