#include<stdio.h> void quicksort(int arr[] ,int left , int right){ if(left>=right)return ; int l , r , flag ; l = left ; r = right; flag = arr[left] ; while(l<r){ while(l<r&&arr[r]>=flag) r--; if(l<r){ arr[l] = arr[r]; l++; } while(l<r&&arr[l]<=flag) l++; if(l<r){ arr[r] = arr[l]; r--; } } if(l==r)arr[l] = flag; quicksort(arr,left ,l-1); quicksort(arr,l+1,right); } int main(void){ int arr[9] = {41,55,62,71,37,2,59,4,135}; quicksort(arr,0,8); int i ; for( i = 0 ; i < 9 ; i++){ printf("%d\n",arr[i]); } return 0; }