Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

quick sort problem

OpenStudy (anonymous):

void quicksort(int *array,int first,int last) { if(first>=last) return; int pivot=partition(array,first,last); quicksort(array,first,pivot-1); quicksort(array,pivot+1,last); } int partition(int *array,int first,int last) { int start,end; start=first; end=last+1; while(1) { while(array[start]>array[++first]) { if(start==last) break; } while(array[start]<array[--end]) { if(end==first) break; } if(start>=end) break; swap(array,start,end); } swap(array,first,end); return(end); } void swap(int *array,int first,int last) { int temp; temp=array[first]; array[first]=array[last]; array[last]=temp; return; }

OpenStudy (anonymous):

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!