All pastes #266317 Raw Edit

Mine

public text v1 · immutable
·published 2006-12-04 00:48 UTC
rendered paste body
template <typename T>
void QuickSort( T array[], int index[], int start, int finish ) {
     int counter;
     int left = start;
     int right = finish;
     T pivot = array[index[(start + finish) / 2]];
     
     do {
          while ( array[index[left]] < pivot ) {
               left++;
          }
          while ( array[index[right]] > pivot ) {
               right--;
          }
          if ( left <= right ) { 
               Swap(&index[left], &index[right]);
               left++;
               right--;
          }
     } while ( left < right );
     if ( start < right ) {
          QuickSort(array, index, start, right);
     }
     if ( left < finish ) {
          QuickSort(array, index, left, finish);
     }
}

int main() {
     Dictionary dictionary;
     vector<string> wrapped;
     int i;
     int arr[5] = {3, 2, 4, 1, 5};
     int index[5] = {1, 2, 3, 4, 5};
     QuickSort(arr, index, 0, 4);
     for ( i = 0; i < 5; i++ ) {
          cout << arr[index[i]];
     }
     
     wrapped = wordwrap("A quick brown fox jumped over the hollow log.  A quick brown fox jumped over the hollow log.  A quick brown fox jumped over the hollow log.", 20);
     for ( i = 0; i < wrapped.size(); i++ ) {
          cout << wrapped[i] << "\n";
     }
               
     MainMenu(dictionary);
     
     Pause();
     return 0;
}