sort

sort algorithms for any type of array
git clone https://noulin.net/git/sort.git
Log | Files | Refs | README | LICENSE

commit 25a46e7e266732b76683f3964040992fd170d2c6
parent d4753e52dc50a892c6bcc1bf30e47d504e1f3166
Author: Remy Noulin <loader2x@gmail.com>
Date:   Sat, 19 Jan 2019 21:47:25 +0100

add radix sort example

README.md | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

Diffstat:
MREADME.md | 31+++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -16,6 +16,37 @@ Include header file: Usage examples are on the top of the headers and in `main.c`. +## radix sort + +radix sort sorts unsigned ints or strings. + +Example: + +```c +// sorting array with string keys + +typ struct { + char *a; + int b; +} skElemt; + +// define macro or function for access the key given an address to an element in the array +#define radixsortAt(ptr) (ptr)->a + +// define a radixsort function with name 'radiS' and 'radiSSafe' sorting arrays with skElemt element type +radixyStringThreadDef(,radiS,skElemt,6,4, 40); +#undef radixsortAt + +// the radiSSafe check if there are empty strings (NULL or "") in the keys +// Empty strings are not allowed. + +// declare array +skElemt radS[200]; + +// sort the array +radiS(radS, sz); +``` + ## flashsort `flashsort.h` is a type safe flashsort implementation.