1           d                                                                                                         Reusable Components - 3 template sort functions for arrays

Uploaded by the author, David Durnell, November 27, 1995.
I do not claim to have invented the sort algorithms used in
the functions.

These functions are freeware, and are freely distributable.
If you modify them, please remove my name from the files.

The author may be contacted at:
david.durnell@jhuapl.edu

I will accept any other sort functions with similar interfaces
to include in a future version of this zip file.

This zip file contains 3 array sort functions: an
insert-sort, a bubble-sort, and a selection-sort.  These
are fairly inefficient (slow) sorting methods.  They do
have one advantage, though, they use only a fixed amount
of memory. If your array is small enough to fit in memory,
you should be able to sort it with these functions.

Each routine has the same interface: the functions want
a pointer to the start array and the size of the array
(in elements).  You can sort a subset of the array by
specifying a start that is actually "into" the array
(eg. array+5), or a size that is smaller than the actual
array.  Since the functions cannot see the actual array
(just a pointer to it), no checks are conducted on the
validity of the array indexes.  In other words, you can
overrun the array (eg. by specifying a size too big) if
you aren't careful.

Any type of array (integer, double, string, user-defined)
may be used.  The only stipulation is that the <, >, and =,
operations must be defined for them (hint - overload).

sorttst.cpp     provides examples for calling the functions.
i_sort.cpp      gives the insert sort function.
b_sort.cpp     gives the bubble sort function.
s_sort.cpp     gives the selection sort function.

Enjoy.                              d  w  .+`7e9*`Me9   57 >`   PП0gp@i*.f`3#i4
_.     i  .w`	_. ,    .`! ,               6  F  H              ?  q  s        S             7  n        O            P          )   )  \  ^  f  7  n        O            P          )      Arial   rray sort functions: an
insert-sort, a bubble-sort, and a selection-sort.  These
are fairly inefficient (slow) so