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
enter height of the shape: 1 3 5 3 1 3 5 7 5 3 5 7 9 7 5 3 5 7 5 3 1 3 5 3 1

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

pls give me answer 01110-00110 in 2''s comlpiment in detail

I have a very confusing assignment and I''m struggling to find the right place to begin or how to break the problem down.

Q: But operator overloading makes class look ugly; isn't it assumed to make my code clearer? A: Operator overloading makes life simpler for the users of a class, not for develop

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

find the c program to find area under the curvey=f(x)   #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area;

one of the segments is showing compilation error...

a program to accept average, if average is 75 to 85 print it out else bypass using counter. enter and process 5 records

I need help to understand and do this assignment ********************************************************* You are to insert the missing code in the C program given for combinatio