home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_08 / 8n08072a < prev    next >
Text File  |  1990-07-18  |  620b  |  29 lines

  1.  
  2.     insertion_sort( int data[], int first, int last )
  3.     {
  4.         int i;
  5.         int j;
  6.         int temp;
  7.  
  8.         for ( i=first+1 ; i <= last ; i++ )
  9.         {
  10.             temp = data[i];
  11.             j = i-1;
  12.             while (j >= first)
  13.             {
  14.                 if ( data[j] > temp )
  15.                 {
  16.                     data[j+1] = data[j];
  17.                     j--;
  18.                 }
  19.                 else
  20.                     break;
  21.             ]
  22.             data[ j+1 ] = temp;
  23.         }
  24.     }
  25.  
  26.                         The Insertion Sort
  27.                              Figure 16
  28.  
  29.