summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-07-19 22:42:53 +0200
committerTyge Løvset <[email protected]>2020-07-19 22:42:53 +0200
commit336a91e14c97f9f9a9cd097bf8fa328b5c3c2715 (patch)
treec1cace64688ab0656904d432fad3d95cde0d321c /examples
parentaf95a56a777bf8521005ac2848ce7e3b3bf08496 (diff)
downloadSTC-modified-336a91e14c97f9f9a9cd097bf8fa328b5c3c2715.tar.gz
STC-modified-336a91e14c97f9f9a9cd097bf8fa328b5c3c2715.zip
Changed API to PriorityQ
Diffstat (limited to 'examples')
-rw-r--r--examples/geek7.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/geek7.c b/examples/geek7.c
index f849a23b..9ca34991 100644
--- a/examples/geek7.c
+++ b/examples/geek7.c
@@ -24,11 +24,11 @@ After inserting all the elements excluding the ones which are to be deleted, Pop
#include <stdio.h>
#include <stc/clist.h>
#include <stc/cmap.h>
-#include <stc/cvecheap.h>
+#include <stc/cvecpq.h>
declare_CMap(ii, int, int);
declare_CVec(i, int);
-declare_CVec_heap(i, >);
+declare_CVec_priorityQ(i, >);
// Find k minimum element from arr[0..m-1] after deleting
// elements from del[0..n-1]
@@ -62,16 +62,17 @@ void findElementsAfterDel(int arr[], int m, int del[],
// Else push it in the min heap
else
- cvec_i_pushHeap(&heap, arr[i]);
+ cvec_i_pushPriorityQ(&heap, arr[i]);
}
// Print top k elements in the min heap
for (int i = 0; i < k; ++i) {
- printf("%d ", cvec_i_topHeap(&heap));
+ printf("%d ", cvec_i_topPriorityQ(&heap));
// Pop the top element
- cvec_i_popHeap(&heap);
- }
+ cvec_i_popPriorityQ(&heap);
+ }
+ cvec_i_destroy(&heap);
}
int main()