/* QSORT Algorithm (p87 of K&R) Defines sort on a sub array of left <= location <= right of an array of integers */ #include void QSort(int v[], int left, int right){ int pivot,last,i; if(left>=right) /* If left=right there is a single array element it is already sorted */ return; /* Select "middle" element as pivot */ pivot= (left+right)/2; /* Puts the pivot value in the left hand location makes it easy to sweep through the rest of the elements */ Swap(v,left,pivot); /* last is the last location in the subarray that has been tested <= the pivot value */ last=left; for(i=left+1; i<=right; i++){ /* sweeps through the array if v[i]< pivot is moved left and stays put otherwise. last is incremented to keep track of the split point */ if(v[i]