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
Your program will read two kinds of data from two files: names and predicates. It will read a formal expression from standard input and check whether that expression is syntactical

# c pragram TO count the number of occurances of the string in nth padovan''s string program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : pa

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

What are all of the implicit member functions of the class? Or what are all of the functions that compiler implements for us if we don't describe one? A: 1.      copy ctor

i need amibroker afl to dll plugin

How I get C, C++, C# .net assignments ?

steric in square

6999066263304447777077766622337778 -----> message sent by the first smuggler. my name is robert---------> message decoded by the second smuggler. Where ‘0’ denotes the "space".

padovan string for natural numbers program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class Padov

How does free know the size of memory to be deleted.? int *i = (int *)malloc(12); followed by free(i); how did free function call know how much of memory to delete? A: It bas