#include<iostream>
using namespace std;
void insertionsort(int a[],int n)
{
int i,j,temp;
for(i=1; i<n; i++)
{
temp=a[i];
for(j=i-1; j>=0 &&temp<a[j];j--)
{
a[j+1]=a[j];
}
a[j+1]=temp;
}
}
int main()
{
int A[]={12,54,543,22,56,212,77,3,35,765};
insertionsort(A,10);
for(int i=0; i<10; i++)
{
cout<<A[i]<<"t";
}
return 0;
}
0 Comments