#include <stdio.h>

static char *utilsid = "$Id: utils.c,v 1.3 1996/12/30 21:51:20 galway Exp $";

/* ***************************************************************** */
/* 

    utils.c

    Copyright (C) 2004  Lionel A. Galway

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    For a copy of the GNU General Public License write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA





   Small utility routines for general use.

   bubsort   Quickie bubble sort.

   L. Galway 16-AUG-1996  */
/* ***************************************************************** */

void bubsort(ary,n)
int *ary,n;
{
  /*  Routine to bubblesort an integer array */
  /*  L. Galway 1-DEC-1995 */

  int i,j,temp;
  /* Set limit at bottom, then move up as sort proceeds */
  for (i=n-1;i>0;i--)
    /* From top, sort to bottom */
    for (j=0;j<i;j++) {
      if (ary[j] > ary[j+1]) {
	temp=ary[j];ary[j]=ary[j+1];ary[j+1]=temp;
      };
    };
  return;
}

