External Sorting Algorithm

Started by cosh, Today at 03:58:40 AM

Previous topic - Next topic

cosh

Hi, fellows.
I recently write an external sorting algorithm and tested it by Pelles C compiler.
https://github.com/coshcage/StoneValley/blob/master/Examples/svxs.h
https://github.com/coshcage/StoneValley/blob/master/Examples/svxs.c
External sorting is a type of sorting algorithm that is used to sort data on an external storage, typically disk.
We all know that the capacity of a disk usually is larger than internal memory (RAM).
The question is how we can sort a massive of data on disk by using limited memory and simultaneously maintain a rapid running speed.
External sorting algorithm is born for this situation.

The implementation of external sorting is at svxs.c and function svXSort is exported to svxs.h.
The usage of function svXSort is listed below:
svXSort
(
[output file],
[input file],
[how many elements to be sorted in the input file],
[how many elements can be loaded into RAM],
[size of an element],
[callback comparator]
);  // Returns 0 for no error.
The final question is how we can test this algorithm.
There is a complete guide at the tail of file svxs.h.

The external sorting function needs StoneValley to be compiled.
*) If svmisc.c(319): error #2083: Invalid address of 'st' with storage class 'register'. this error occurs during compiling your project, please delete the 'REGISTER' qualifier at svmisc.c line 319 and re-compile it again.

There you go, thank you guys to read this article and use my external sorting function.
I'm here to wait for your replies.