Updating examples readme and added multiset to benchmark
This commit is contained in:
1 parent
976965bcfa
commit
7de3ce5c0c
4 files changed
+17
-11
No files matched your search
+13
-9
@@ -59,18 +59,20 @@ void shuffle(int *array, mt_state_ptr st)
|
||||
}
|
||||
}
|
||||
|
||||
COLLECTION_GENERATE(LIST, l, list, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(STACK, s, stack, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(QUEUE, q, queue, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(DEQUE, d, deque, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(LINKEDLIST, ll, linked, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(HEAP, h, heap, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(TREESET, ts, tset, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(TREEMAP, tm, tmap, /* FMOD */, int, int)
|
||||
COLLECTION_GENERATE(HASHSET, hs, hset, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(HASHMAP, hm, hmap, /* FMOD */, int, int)
|
||||
COLLECTION_GENERATE(MULTIMAP, mm, mmap, /* FMOD */, int, int)
|
||||
COLLECTION_GENERATE(HASHSET, hs, hset, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(HEAP, h, heap, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(LINKEDLIST, ll, linked, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(LIST, l, list, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(QUEUE, q, queue, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(STACK, s, stack, /* FMOD */, /* K */, int)
|
||||
COLLECTION_GENERATE(TREEMAP, tm, tmap, /* FMOD */, int, int)
|
||||
COLLECTION_GENERATE(TREESET, ts, tset, /* FMOD */, /* K */, int)
|
||||
|
||||
COLLECTION_GENERATE(INTERVALHEAP, ih, iheap, , , int)
|
||||
COLLECTION_GENERATE(MULTIMAP, mm, mmap, /* FMOD */, int, int)
|
||||
COLLECTION_GENERATE(MULTISET, ms, mset, /* FMOD */, /* K */, int)
|
||||
|
||||
#define BENCHMARK(NAME, PFX, sname, initfunc, insertbody, removebody, searchbody) \
|
||||
void NAME##_io_benchmark(int *array, int *sarray, size_t s) \
|
||||
@@ -186,6 +188,7 @@ BENCHMARK(TREESET, ts, tset, ts_new(intcmp), ts_insert(coll, array[i]), ts_remov
|
||||
|
||||
BENCHMARK(INTERVALHEAP, ih, iheap, ih_new(NTOTAL, intcmp), ih_insert(coll, array[i]), ih_remove_max(coll, &r), ih_contains(coll, sarray[i]))
|
||||
BENCHMARK(MULTIMAP, mm, mmap, mm_new(NTOTAL, 0.8, intcmp, inthash), mm_insert(coll, array[i], array[i]), mm_remove(coll, array[i], &r), mm_contains(coll, sarray[i]))
|
||||
BENCHMARK(MULTISET, ms, mset, ms_new(NTOTAL, 0.6, intcmp, inthash), ms_insert(coll, array[i]), ms_remove(coll, array[i]), ms_contains(coll, sarray[i]))
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@@ -231,6 +234,7 @@ int main(void)
|
||||
|
||||
INTERVALHEAP_io_benchmark(array, array, NMIN);
|
||||
MULTIMAP_io_benchmark(array, array, NTOTAL);
|
||||
MULTISET_io_benchmark(array, array, NTOTAL);
|
||||
|
||||
free(array);
|
||||
free(sarray);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Leonardo Vencovsky (https://github.com/LeoVen)
|
||||
*
|
||||
* Mersenne Twister PRNG utility
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* iterators - Examples of using the collection's iterators
|
||||
* linkedlist - LINKEDLIST collection examples
|
||||
* list - LIST collection examples
|
||||
* multimap - MULTIMAP collection examples
|
||||
* multiset - MULTISET collection examples
|
||||
* others - Other examples, generally more robust and using multiple collections
|
||||
* queue - QUEUE collection examples
|
||||
* stack - STACK collection examples
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Multiset examples
|
||||
|
||||
* prime_cof.c - Prime factorization of a number.
|
||||
* multiset_operations.c - Demonstrates common multiset operations.
|
||||
Reference in new issue
Block a user