C++ Program for Insertion sort

C++ Program for Insertion sort

/**************************************************************	
	Author: Arun Vishnu M V
	Web: www.arunmvishnu.com
	Description: C++ Program for Insertion sort.
***************************************************************/
#include<conio.h>   	
#include<iostream.h>  
int main()
{
	int array[100],n,i,j,key;
	clrscr();
	cout<<"How many numbers--> ";
	cin>>n;
	cout<<"Enter "<>array[i];
	for(i=1;i=0 && array[j]>key)
		{
			array[j+1]=array[j];
			j--;
		}
		array[j+1]=key;
	}
	cout<<"\nArray is sorted in ascending order.\n";
	for(i=0;i

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *