ProgramCodingFor_InsertionSort_in C++
Program coding in C++:
//Program to Sort an Array in descending order //
//by INSERTION SORT Method//
#include
#include
void main()
{
int *a,size,n,c = 0,k,i,temp,j,pos;
cout<<"\n Input the size of the array : ";
cin>>size;
a = new int(size);
for(i = 0;i>a[i];
}
i = 0;
n = size;
while(ia[j])
{
pos = j;
c = 1;
break;
}
}
if(c= =1)
{
for(j = i;j>= pos;--j)
{
a[j+1] = a[j];
}
a[pos] = temp;
}
i = i+1;
}
cout << "\n Sorted List ";
for(k = 0;k
Description
To help the reader, how to write the program based on Algorithm and to execute the msthod practically to see the result. Please write the feed back also
Presentation Transcript
Your Facebook Friends on WizIQ