测试,第二篇文章

int Partition(int array[], int length, int start, int end){
if (array == NULL || length < 0 || start <0 || end> length){
return ;
}

int index = RandomInRange(start, end);
swap(&array[index], &array[end]);
int small = start - 1;
for (index = start ; index < end; ++index){
if (array[index] < array[end]){
small ++;
if (small != index){
swap(&array[small], &array[index]);
}
}
}
small ++;
swap(&array[small], &array[end]);
}