bucketsort: add comments

This commit is contained in:
Jörg Thalheim 2015-04-28 15:24:28 +02:00
parent 7bafc2bbab
commit ebb2a0279c

View File

@ -2,6 +2,8 @@
#include <string.h>
#include "bucketsort.h"
// Printable characters in Ascii (from 34 to 127);
// actually 127 is also not printable
#define N_BUCKETS 94
typedef struct {
@ -42,6 +44,7 @@ long int* bucket_sort(char *a, int length, long int size) {
// copy the keys to "buckets"
for (i = 0; i < size; i++) {
// 0x21 = 33d, number of unprintable characters in Ascii
b = &buckets[*(a + i * length) - 0x21];
b->data[b->total++] = i;
}