The big sort routine implements a way to sort huge amounts of data using C programming language. It sorts the data that do not fit into main memory by using a multi-phase sorting on files. It is a implementation from the book “Algorithms and data structures” by Niklaus Wirth. Additionally, this routine recognizes small amounts of data that do fit into memory and resorts to a in-place quicksort.

Inside this source code you shall find implementations of Sorting Arrays, Binary search implementation, heapsort, quicksort, minimize memory requirement, use of Fibonacci numbers, insertion sort algorithm

**Sort Huge amount of data** (20.0 KiB, 4,374 hits)

## Example Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | //Example 1: To generate a quicksort routine which sorts an integer array //in increasing order, use the following lines: | Left margin V #define GENSORT_NAME intquicksort #define GENSORT_TYPE int #define GENSORT_KEYTYPE int #define GENSORT_GETKEY(a) a #define GENSORT_COMPAREKEYS(k1,k2) k1 < k2 #include "gensort.h" //Example 2: To generate a pointer quicksort routine that sorts a structure //according to a string in the key field (<string.h> is included to get //the prototype for the strcmp function): | Left margin V #include <string.h> struct Test { char *KeyString; int OtherFields; .... }; #define GENSORT_NAME namequicksort #define GENSORT_TYPE struct Test #define GENSORT_KEYTYPE char * #define GENSORT_GETKEY(a) a.KeyString #define GENSORT_COMPAREKEYS(k1,k2) strcmp(k1,k2) < 0 #define GENSORT_USEPOINTERS #include "gensort.h" |

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

Bug reports, questions, improvements, mail to JÃ¶rg SchÃ¶n

## Copyright

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.