diff options
| author | Tyge Løvset <[email protected]> | 2023-01-10 16:59:41 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-01-10 17:06:09 +0100 |
| commit | b3313ff01a8069592f63b18372fd0cf9e6c077bd (patch) | |
| tree | a5a503da49c806555878945c888cfba87fe3c943 /misc/examples | |
| parent | 7abea5ab04bffebbedfad7bd8d9c5c26170d19af (diff) | |
| download | STC-modified-b3313ff01a8069592f63b18372fd0cf9e6c077bd.tar.gz STC-modified-b3313ff01a8069592f63b18372fd0cf9e6c077bd.zip | |
Some updates on algo/csort.h and example.
Diffstat (limited to 'misc/examples')
| -rw-r--r-- | misc/examples/sort.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/misc/examples/sort.c b/misc/examples/sort.c index ace1a6a4..711ba7a6 100644 --- a/misc/examples/sort.c +++ b/misc/examples/sort.c @@ -3,8 +3,8 @@ #include <stdio.h> #include <stc/crandom.h> -typedef float Elem; -#define fmt_Elem "%g" +typedef long long Elem; +#define fmt_Elem "%lld" #ifdef __cplusplus #include <algorithm> #else @@ -50,5 +50,12 @@ int main(int argc, char *argv[]) { for (i = 0; i < size; i++) a[i] = 126735; testsort(a, size, "constant"); + for (i = 0; i < size; i++) a[i] = i + 1; + a[size - 1] = 0; + testsort(a, size, "rotated"); + + for (i = 0; i < size; i++) a[i] = i % (size / 2); + testsort(a, size, "repeated"); + free(a); } |
