From 7946c8efc2e2a44a8e78e1263c1691ce9f412a09 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 18 Jul 2024 11:09:50 +0200 Subject: Converted set to map --- test/112_h48set/00_small.in | 6 -- test/112_h48set/00_small.out | 3 - test/112_h48set/01_large.in | 153 ----------------------------------------- test/112_h48set/01_large.out | 83 ---------------------- test/112_h48set/h48set_tests.c | 64 ----------------- 5 files changed, 309 deletions(-) delete mode 100644 test/112_h48set/00_small.in delete mode 100644 test/112_h48set/00_small.out delete mode 100644 test/112_h48set/01_large.in delete mode 100644 test/112_h48set/01_large.out delete mode 100644 test/112_h48set/h48set_tests.c (limited to 'test/112_h48set') diff --git a/test/112_h48set/00_small.in b/test/112_h48set/00_small.in deleted file mode 100644 index d788d5b..0000000 --- a/test/112_h48set/00_small.in +++ /dev/null @@ -1,6 +0,0 @@ -11 -7 -3 -34 -45 -34 diff --git a/test/112_h48set/00_small.out b/test/112_h48set/00_small.out deleted file mode 100644 index 29c08e5..0000000 --- a/test/112_h48set/00_small.out +++ /dev/null @@ -1,3 +0,0 @@ -2 -34 -45 diff --git a/test/112_h48set/01_large.in b/test/112_h48set/01_large.in deleted file mode 100644 index a70ef9a..0000000 --- a/test/112_h48set/01_large.in +++ /dev/null @@ -1,153 +0,0 @@ -307 -293 -150 -100053 -100045 -100007 -100007 -100011 -100072 -100033 -100015 -100013 -100068 -100047 -100046 -100000 -100076 -100021 -100019 -100015 -100049 -100052 -100071 -100058 -100009 -100060 -100030 -100051 -100069 -100011 -100051 -100014 -100031 -100017 -100076 -100016 -100030 -100037 -100011 -100002 -100029 -100022 -100038 -100075 -100066 -100051 -100020 -100039 -100029 -100087 -100099 -100041 -100042 -100026 -100060 -100006 -100010 -100079 -100046 -100086 -100010 -100036 -100047 -100069 -100041 -100074 -100090 -100092 -100020 -100096 -100046 -100028 -100072 -100096 -100025 -100001 -100067 -100044 -100063 -100026 -100062 -100091 -100012 -100073 -100051 -100010 -100096 -100043 -100025 -100077 -100089 -100005 -100024 -100091 -100046 -100053 -100058 -100065 -100051 -100056 -100025 -100093 -100088 -100033 -100073 -100048 -100059 -100027 -100045 -100012 -100059 -100084 -100017 -100048 -100004 -100051 -100016 -100088 -100033 -100064 -100060 -100043 -100084 -100026 -100051 -100060 -100069 -100015 -100014 -100038 -100068 -100038 -100097 -100017 -100013 -100053 -100019 -100018 -100081 -100071 -100025 -100014 -100016 -100011 -100069 -100079 -100063 -100070 -100072 -100095 -100042 -100008 -100022 diff --git a/test/112_h48set/01_large.out b/test/112_h48set/01_large.out deleted file mode 100644 index 6632336..0000000 --- a/test/112_h48set/01_large.out +++ /dev/null @@ -1,83 +0,0 @@ -82 -100000 -100001 -100002 -100004 -100005 -100006 -100007 -100008 -100009 -100010 -100011 -100012 -100013 -100014 -100015 -100016 -100017 -100018 -100019 -100020 -100021 -100022 -100024 -100025 -100026 -100027 -100028 -100029 -100030 -100031 -100033 -100036 -100037 -100038 -100039 -100041 -100042 -100043 -100044 -100045 -100046 -100047 -100048 -100049 -100051 -100052 -100053 -100056 -100058 -100059 -100060 -100062 -100063 -100064 -100065 -100066 -100067 -100068 -100069 -100070 -100071 -100072 -100073 -100074 -100075 -100076 -100077 -100079 -100081 -100084 -100086 -100087 -100088 -100089 -100090 -100091 -100092 -100093 -100095 -100096 -100097 -100099 diff --git a/test/112_h48set/h48set_tests.c b/test/112_h48set/h48set_tests.c deleted file mode 100644 index d9310a9..0000000 --- a/test/112_h48set/h48set_tests.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "../test.h" - -char str[STRLENMAX]; - -typedef struct { - int64_t n; - int64_t capacity; - int64_t mod; - int64_t *table; -} h48set_t; - -void h48set_create(h48set_t *, int64_t, int64_t); -void h48set_clear(h48set_t *); -void h48set_destroy(h48set_t *); -int64_t h48set_lookup(h48set_t *, int64_t); -void h48set_insert(h48set_t *, int64_t); -bool h48set_contains(h48set_t *, int64_t); -int64_t h48set_save(h48set_t *, int64_t *); - -int compare(const void *x, const void *y) { - int64_t a = *(int64_t *)x; - int64_t b = *(int64_t *)y; - - if (a > b) return 1; - if (a == b) return 0; - return -1; -} - -int64_t readl(void) { - fgets(str, STRLENMAX, stdin); - return atoll(str); -} - -void run(void) { - h48set_t set; - int64_t n, i, k, capacity, mod, *a, *b; - - capacity = readl(); - mod = readl(); - n = readl(); - - a = malloc(n * sizeof(int64_t)); - b = malloc(n * sizeof(int64_t)); - for (i = 0; i < n; i++) - a[i] = readl(); - - h48set_create(&set, capacity, mod); - for (i = 0; i < n; i++) - h48set_insert(&set, a[i]); - - k = h48set_save(&set, b); - qsort(b, k, sizeof(int64_t), compare); - - printf("%" PRId64 "\n", k); - for (i = 0; i < k; i++) - printf("%" PRId64 "\n", b[i]); - for (i = 0; i < n; i++) - if (!h48set_contains(&set, a[i])) - printf("Set does not contain %" PRId64 "\n", a[i]); - - h48set_destroy(&set); - free(a); - free(b); -} -- cgit v1.3