// Copyright (c) 1992 by Timothy A. Budd. All Rights Reserved. // may be reproduced for any non-commercial purpose # include "vector.h" template void treeSort(vector & v) { // declare an search tree of the correct type avlTree sorter; // copy the entire vector into the tree vectorIterator vitr(v); for (vitr.init(); ! vitr; ++vitr) sorter.add(vitr()); // now copy the values back into the array int i = 0; searchTreeIterator itr(sorter); for (itr.init(); ! itr; ++itr) v[i++] = itr(); }