Insertion sort - C program:
Write a program in c to define a insertion sort.
void main()
{
clrscr();
int a[100],ch,n;
cout<<"enter the limit for the array : ";
cin>>n;
for (int i=0;i
cout<<"enter element "<
cin>>a[i];
}
cout<<"1. insertion sorting "<
isort(a,n);
void isort(int a[100],int n)
int te,i,j;
for(i=1; i
te=a[i];
j=i-1;
while (te=0)
a[j+1]=a[j];
j=j-1;
a[j+1]=te;
cout<<" sorted arrays by insertion "<<"\n\n";
for(i=0; i
cout<
getch();