Skip to main content

Posts

Showing posts from September 5, 2009

Insertion Sort

/**     Program Name: Insertion Sort     Description: This Program Sorts an Array using Insertion Sort Algorithm     Author:  Tauqirul Haque        */  #include <stdio.h> #include <conio.h> #define MAX 10 void insertionSort(int []); void displayArray(int []); void main() {     int array[MAX] = {-999, 78,3,567,99,34,65,34,12, 55};  //this first element is the sentinel        printf("\nThe Element Before Sorting .. ");     displayArray(array);        insertionSort(array);        printf("\nThe Element After Sorting ... ");     displayArray(array);        getch(); } void insertionSort(int array[MAX]) {     int i;     for(i=2;i     {         in...