Professional Documents
Culture Documents
h>
# include<stdlib.h>
else
{
temp[t] = list[s] ;
s ++;
}
t ++;
}
if(f <=n)
{
for(f = f ; f<=n; f++)
{
temp[t] = list[f];
t++;
}
}
else
{
for(s = s ; s<= bottom ; s++)
{
temp[t]=list[s];
t++;
}
}
for(upper = top; upper <= bottom ; upper++)
{
list[upper]=temp[upper];
}
void main()
{
int list[100];
int i, n;
printf("Input the number of element: ");
scanf("%d", &n);
for( i = 0 ; i<n ; i++)
{
printf("\n Entered list as follows %d:",i+1);
scanf("%d",&list[i]);
}
i=0;
merge_pass(list, i, n-1);
printf("\n Merge sorted list is as follows:\n");
for( i = 0 ; i<n ; i++)
printf(" %d", list[i]);
}