- #include <stdio.h>
- #include <string.h>
- int quicksortback(int array[],int start,int end){
- if(start<end){
- int low=start;
- int high=end;
- int key;
- key=array[low];
- while(low<high){
- while(low<high&&array[high]<=key){
- high--;
- }
- if(low<high)
- array[low]=array[high];
- while(low<high&&array[low]>key)
- low++;
- if(low<high)
- array[high]=array[low];
- array[low]=key;
- }
- quicksortback(array,start,low-1);
- quicksortback(array,low+1,end);
- }
- }
- int main(){
- int test[]={1,2,3,2,5,7,0,5,4,6,9};
- int i=0;
- quicksortback(test,0,10);
- for(i=0;i<=10;i++){
- printf("%d",test[i]);
- }
- system("pause");
- return 0;
- }
- //该片段来自于http://www.codesnippet.cn/detail/2601201511642.html
来源: http://www.codesnippet.cn/detail/2601201511642.html