void quicksort_rec(void* base,int size, int beg,int end) { void* piv; int y,z; if(beg < end) { piv = base; y = beg; z = end; while(y < z) { while((y <= end) && (base+(y*size) <= piv)) y++; while((z >= beg) && (base+(z*size) > piv)) z--; if(y < z) swapElem(base+(y*size), base+(z*size)); } swapElem(base+(beg*size),base+(z*size)); quicksort_rec(base, size, beg, z-1); quicksort_rec(base, size, z+1, end); } }
/* QUICK SORT RECURSIVE*/ void quicksort_rec(int *arr,int start,int end) { int mid,pivot; if(start==end) return; pivot = start; mid = partition(pivot,arr,start,end); /* quick sort each of the two halves of the array */ quicksort_rec(arr,start,mid); quicksort_rec(arr,mid+1,end); }