Insertion sort - c program, C/C++ Programming

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];

                }

                clrscr();

                cout<<"1. insertion sorting "<

                isort(a,n);

                 }

 }

void isort(int a[100],int n)

 {

                 clrscr();

                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();

 }

Posted Date: 10/19/2012 3:10:14 AM | Location : United States







Related Discussions:- Insertion sort - c program, Assignment Help, Ask Question on Insertion sort - c program, Get Answer, Expert's Help, Insertion sort - c program Discussions

Write discussion on Insertion sort - c program
Your posts are moderated
Related Questions
Task 1 Demonstrate a Java client and server exchanging one text message in each direction. Task 2 Demonstrate a C client and server exchanging one text message in each

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

List any six commonly found programming errors in a C program Six commonly found errors in a C program are: 1.  Missing or misplaced  ; or  }, missing return type for a proc

TO CONVERT A NUMBER OR A DIGIT INTO ALPHABET


Aim: To implement a program to allocate memory dynamically for 2 dimensional array (accept and print matrix) using pointers. Code:                       #include #inc

Create a function ValueDelta(char inName[], char outName[]) that reads a text file with option specifications and writes the option values as well as Delta. The inName[] file conta

We need an E Commerce site likefifacointrader. you must have experience with that kind of work You have to show a sample of work like that site. Skills required are C Prog


Described the order that objects in an array is destructed?