aboutsummaryrefslogtreecommitdiff
path: root/advent-of-code/2022/lib/pque.h
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2024-01-27 14:28:51 +0800
committerMistivia <i@mistivia.com>2024-01-27 14:28:51 +0800
commit087a111b3417cbda03a3453b3d16dd4d1cf54a9e (patch)
tree000a15054865c3fb974970238568bb1d81a3f29e /advent-of-code/2022/lib/pque.h
parent203658f4a5b8649d0142ab8ff6440eb0eefa48e9 (diff)
add aoc 2022
Diffstat (limited to 'advent-of-code/2022/lib/pque.h')
-rw-r--r--advent-of-code/2022/lib/pque.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/advent-of-code/2022/lib/pque.h b/advent-of-code/2022/lib/pque.h
new file mode 100644
index 0000000..0d86560
--- /dev/null
+++ b/advent-of-code/2022/lib/pque.h
@@ -0,0 +1,18 @@
+#ifndef PQUEUE_H_
+#define PQUEUE_H_
+
+typedef struct {
+ void *buf;
+ int elemsz;
+ int cap;
+ int size;
+ int (*cmp)(void*, void*);
+} PQue;
+
+void pq_init(PQue *pq, int cap, int elemsz, int (*cmp)(void*, void*));
+void pq_push(PQue *pq, void *elem);
+void pq_pop(PQue *pq);
+void* pq_top();
+
+#endif
+