# sort -- quicksort of array x between indexes lo and hi, inclusive
function sort(x, lo, hi,		m, i, h)
{
    if (lo < hi) {
	m = lo;
	for (i = lo; i < hi; i++) {
	    if (x[i] < x[hi]) { h = x[i]; x[i] = x[m]; x[m] = h; m++; }
	}
	h = x[m]; x[m] = x[hi]; x[hi] = h;
	sort(x, lo, m - 1);
	sort(x, m + 1, hi);
    }
}
