53 ,
const int &RightBound
54 ,
double *ArrayOfValues)
62 CurrentValue = ArrayOfValues[(LeftBound + RightBound) / 2] ;
63 FirstLoopVariable = LeftBound ;
64 SecondLoopVariable = RightBound ;
67 while ( FirstLoopVariable <= SecondLoopVariable )
69 while( ArrayOfValues[FirstLoopVariable] < CurrentValue )
71 FirstLoopVariable = FirstLoopVariable + 1;
74 while ( ArrayOfValues[SecondLoopVariable] > CurrentValue )
76 SecondLoopVariable = SecondLoopVariable - 1;
79 if ( FirstLoopVariable <= SecondLoopVariable )
82 HelpVariable = ArrayOfValues[FirstLoopVariable] ;
83 ArrayOfValues[FirstLoopVariable] = ArrayOfValues[SecondLoopVariable] ;
84 ArrayOfValues[SecondLoopVariable] = HelpVariable ;
85 FirstLoopVariable = FirstLoopVariable + 1 ;
86 SecondLoopVariable = SecondLoopVariable - 1 ;
91 if ( LeftBound < SecondLoopVariable )
98 if ( FirstLoopVariable < RightBound )
Header file for the Quicksort algorithm.
void Quicksort(const int &LeftBound, const int &RightBound, double *ArrayOfValues)
Standard implementation of the Quicksort algorithm for double values.