//
#include "stdio.h"
{
int temp = *pValue1;
*pValue1 = *pValue2;
*pValue2 = temp;
}
//Parameters: a is array, sPoint is start point, ePoint is end point
//Function: make the array to two parts, one is small part, the other is big one
// all points in small part is smaller than each one in the big part
// ok, and the third part is the eValue and after this function, it is
// the value of the middle point.
//Return: and the i+1 is the middle point, which is the return value
//
int Partion(int * a, int sPoint, int ePoint)
{
int eValue = a[ePoint];
int i = sPoint -1;
int j = 0;
{
if(a[j] <= eValue)
{
i = i + 1;
Swap(&a[i], &a[j]);
}
}
}
//when the start point smaller than the end point to make array to two part
//and quicksort the two part of the array
//
void QuickSort(int * a, int sPoint, int ePoint)
{
if(sPoint < ePoint)
{
int mPoint = Partion(a, sPoint, ePoint);
QuickSort(a, sPoint, mPoint-1);
QuickSort(a, mPoint+1, ePoint);
}
return;
}
int main(int argc, char* argv[])
{
int i = 0;
int array[10] = {3, 7, 4, 9, 1, 2, 6, 5, 8, 6};
printf("array sort is \n");
{
printf("%d ",array[i]);
}
}