In a lot of programs my gensortutility turned out to be very useful. It consists simply of the header file “gensort.h“, contained in the above package. To obtain a sorting routine, simply define the name of the routine, the data type you want to sort and how to compare items with preprocessor symbols, and then simply say

#include <gensort.h>

There you have a fast and reliable Quicksort (or alternatively Heapsort) routine! The abilities of the gensort generated routines are identical to those obtained by using the qsort routine from the ANSI-C standard, but by far faster! The package contains a test program testsort.c that compares the qsort routines versus the gensortgenerated ones.

A long description how to use it along with some easy examples is at the begin of the header file gensort.h itself.


This program is Copyright ? 1993-1995 by Joerg Schoen. Permission to use, copy and distribute this software together with its documentation for any purpose is herby granted provided that the above copyright notice appears in all copies. No fee must be taken for this package. This software is provided “as is” without expressed or implied warranty.

Bug reports, questions, improvements, mail to J?rg Sch?n

  Generating fast sorting routines (7.2 KiB, 3,807 hits)


See also: Shell Sort, Quick Sort, Bubble Sort, Insertion Sort, Selection Sort