Listing 2 Recursive Quicksort Routine

void
QuickSort( int *List, int Begin, int End )
{
       int Value, Tmp, i, j;

       if( End > Begin )
       {
              /* Divide the list in two */
              Value = List[End];
              i = Begin - 1;
              j = End;
              do {
                     while( List[++i] < Value );
                     while( List[--j] > Value );
                     Tmp = List[i];
                     List[i] = List[j];
                     List[j] = Tmp;
              } while( j > i );
              List[j] = List [i];
              List[i] = List[End];
              List[End] = Tmp;
              /* Sort the first part */
              QuickSort( List, Begin, i - 1 );
              /* Sort the last part */
              QuickSort( List, i + 1, End );
       }
}