From 741632132ddbd1c5797b85998e08c80208d53f7d Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 19 Jul 2020 22:55:40 +0200 Subject: Fixed example. --- stc/cvecpq.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/stc/cvecpq.h b/stc/cvecpq.h index 40d2603b..a6134620 100644 --- a/stc/cvecpq.h +++ b/stc/cvecpq.h @@ -30,11 +30,15 @@ int main() { pcg32_random_t pcg = pcg32_seed(1234, 0); CVec_i heap = cvec_init; - for (int i=0; i<100; ++i) cvec_i_pushPriorityQ(&heap, pcg32_random(&pcg)); - for (int i=0; i<5; ++i) { - printf("%d ", cvec_i_topPriorityQ(&heap, pcg32_random(&pcg))); - cvec_i_popPriorityQ(&heap, pcg32_random(&pcg)); + // Push on one million random numbers + for (int i=0; i<1000000; ++i) + cvec_i_pushPriorityQ(&heap, pcg32_random(&pcg)); + // Extract the 100 smallest. + for (int i=0; i<100; ++i) { + printf("%d ", cvec_i_topPriorityQ(&heap)); + cvec_i_popPriorityQ(&heap); } + cvec_i_destroy(&heap); } */ -- cgit v1.2.3