void InsertionSort(int a[],int n)
{
int i,j,temp;
for(i=1;i<n;i++)
{
temp=a[i];
j=i-1;
while(temp<a[j])&&j>=0)
{ a[j+1]=a[j];
j – -;
}
a[j+1]=temp;
cout<,”\n After Pass “<<i ;
for(k=0;k<n;k++)
cout<<a[k];
} }
No comments:
Post a Comment