SHELLSORT - a shell sort.

Usage:

B:
   shellsort( vec, max [, compare] );
C:
   void shellsort(void *vec, int vec [, void *compare] );

Where:

vec
points to the vector of words to be sorted.
max
is the maximum index of "vec" (so that the elements to be sorted are "vec[0]" to "vec[max]").
compare
is the name of a comparison function as described below.

Description:

SHELLSORT sorts the vector "vec" according to the comparison rule implemented by the function "compare". "compare" may be omitted in the argument list; if so, a default comparison routine (see below) will be called. The "compare" function is called by SHELLSORT with the following call.

res = compare( a, b );

"compare" must return a positive value if a > b, zero if a == b, and a negative value if a < b. The default comparison function simply compares a with b as signed, one-word integers, but a user-supplied routine might use "a" and "b" as B type strings to be compared (for example). This makes SHELLSORT a general sorting routine.

See Also:

expl b lib qsort

Copyright © 1996, Thinkage Ltd.