quick2.c
contents ::
  address.c
  atquick_sort.c
  bits.c
  countspace.c
  ctof.c
  hextoint.c
  hist.c
  indexof.c
  itob.c
  linkage.c
  lzw.c
  maxval.c
  merge.c
  merge_sort.c
  peof.c
  pointer.c
  quick2.c
  quick.c
  quick_sort.c
  reverse.c
  rftoc.c
  rmultiblank.c
  rtabs.c
  squeeze.c
  structoo.c
  syscall.c
  tempfunc.c
  tfc.c
  word.c


void quicksort(int a[], int lo, int hi){
  if( hi > lo ) {
    int left, right, median, temp;
    left=lo;
    right=hi;
    median=a[(lo+hi)/2];
    while(right >= left){
      
      while(a[left] < median) left++;
      
      while(a[right] > median) right--;
      if(left > right) break;
      
      temp=a[left];
      a[left]=a[right];
      a[right]=temp; //swap
      
      left++;
      right--;
    }

    
    quicksort(a, lo, right);// divide and conquer
    quicksort(a, left,  hi);
  }
}/*quicksort*/

James Little