Add more sorting algorithms

This commit is contained in:
Justine Tunney 2023-04-27 05:42:10 -07:00
parent b7bf052a4b
commit 7c9ef924bf
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
17 changed files with 49004 additions and 5 deletions

25
examples/vqsort.c Normal file
View file

@ -0,0 +1,25 @@
#if 0
/*─────────────────────────────────────────────────────────────────╗
To the extent possible under law, Justine Tunney has waived
all copyright and related or neighboring rights to this file,
as it is written in the following disclaimers:
http://unlicense.org/ │
http://creativecommons.org/publicdomain/zero/1.0/ │
*/
#endif
#include "third_party/vqsort/vqsort.h"
#include "libc/macros.internal.h"
#include "libc/stdio/stdio.h"
#include "third_party/vqsort/vqsort.h"
// how to sort one gigabyte of 64-bit integers per second
int main(int argc, char *argv[]) {
int64_t A[] = {9, 3, -3, 5, 23, 7};
vqsort_int64(A, ARRAYLEN(A));
for (int i = 0; i < ARRAYLEN(A); ++i) {
if (i) printf(" ");
printf("%ld", A[i]);
}
printf("\n");
}