Posted By

Insertion Sort Program in C

Education 2

#include<stdio.h>

int main()


{       

    int i, j, temp;    

    int size=10;     

    int number[10] = {9, 10, 13, 14, 61, 17, 91, 11, 21, 3};         


    for(i=1;i<size;i++){

        temp=number[i];

        j=i-1;

        while((temp<number[j])&&(j>=0)){

            number[j+1]=number[j];

            j=j-1;

        }

        number[j+1]=temp;

    }      


printf("Sorted elements by Using Insertion Sort: ");     


    for(i=0;i<size;i++)

        printf(" %d",number[i]);       

    return 0;  

Insertion Sort Program in C

Login to comment login

Latest Jobs
  • Chapai Nawabganj Municipality Night Guard Job Circular
    Chapai Nawabganj Municipality
    Education: Class 8
    Experience: 0 Years
    Deadline: 29 Nov 2018
  • Chapai Nawabganj Municipality Pipe line mechanic Job Circular
    Chapai Nawabganj Municipality
    Education: Class 8
    Experience: 0 Years
    Deadline: 29 Nov 2018
  • Chapai Nawabganj Municipality Electrician Job Circular
    Chapai Nawabganj Municipality
    Education: S.S.C/ Equivalent
    Experience: 0 Years
    Deadline: 29 Nov 2018
  • Chapai Nawabganj Municipality Surveyor  Job Circular
    Chapai Nawabganj Municipality
    Education: Diploma in Survey
    Experience: 0 Years
    Deadline: 29 Nov 2018
  • Chapai Nawabganj Municipality Market collector Job Circular
    Chapai Nawabganj Municipality
    Education: H.S.C/ Equivalent
    Experience: 0 Years
    Deadline: 29 Nov 2018