diff options
| author | Tyge Løvset <[email protected]> | 2020-12-17 13:13:11 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-12-17 13:13:11 +0100 |
| commit | 512086cdf69bbfadd794fb5e751fb681222a4adf (patch) | |
| tree | ea3b87efda66382c2728990618ca3a6ae30bc3af /examples/priority.c | |
| parent | 83a259d155742f669b972649ff8c9607c8abe081 (diff) | |
| download | STC-modified-512086cdf69bbfadd794fb5e751fb681222a4adf.tar.gz STC-modified-512086cdf69bbfadd794fb5e751fb681222a4adf.zip | |
Renamed cpqueue (priority queue) container to cpque.
Diffstat (limited to 'examples/priority.c')
| -rw-r--r-- | examples/priority.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/priority.c b/examples/priority.c index 40fb395e..4eb762ec 100644 --- a/examples/priority.c +++ b/examples/priority.c @@ -2,34 +2,34 @@ #include <stdio.h>
#include <time.h>
#include <stc/cvec.h>
-#include <stc/cpqueue.h>
+#include <stc/cpque.h>
#include <stc/cmap.h>
#include <stc/crand.h>
using_cvec(i, int64_t);
-using_cpqueue(i, cvec_i, >); // min-heap (increasing values)
+using_cpque(i, cvec_i, >); // min-heap (increasing values)
int main() {
size_t N = 10000000;
crand_t rng = crand_init(time(NULL));
crand_uniform_t dist = crand_uniform_init(0, N * 10);
- cpqueue_i heap = cpqueue_i_init();
+ cpque_i heap = cpque_i_init();
// Push ten million random numbers to priority queue
c_forrange (N)
- cpqueue_i_push(&heap, crand_uniform(&rng, &dist));
+ cpque_i_push(&heap, crand_uniform(&rng, &dist));
// push some negative numbers too.
- c_push_items(&heap, cpqueue_i, {-231, -32, -873, -4, -343});
+ c_push_items(&heap, cpque_i, {-231, -32, -873, -4, -343});
c_forrange (N)
- cpqueue_i_push(&heap, crand_uniform(&rng, &dist));
+ cpque_i_push(&heap, crand_uniform(&rng, &dist));
// Extract the hundred smallest.
c_forrange (100) {
- printf("%zd ", *cpqueue_i_top(&heap));
- cpqueue_i_pop(&heap);
+ printf("%zd ", *cpque_i_top(&heap));
+ cpque_i_pop(&heap);
}
- cpqueue_i_del(&heap);
+ cpque_i_del(&heap);
}
|
