Add priority queue
This commit is contained in:
parent
ccf1950cf4
commit
6302207a1d
4 changed files with 163 additions and 0 deletions
23
include/htd/data_structure/priority_queue.h
Normal file
23
include/htd/data_structure/priority_queue.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef PRIORITY_QUEUE_H
|
||||
#define PRIORITY_QUEUE_H
|
||||
|
||||
#include <htd/primitives/primitives.h>
|
||||
|
||||
typedef struct {
|
||||
void* data;
|
||||
|
||||
isize (*compare)(void*, void*);
|
||||
usize data_size;
|
||||
usize capacity;
|
||||
usize len;
|
||||
} PriorityQueue;
|
||||
|
||||
void prioq_init(PriorityQueue* prioq, usize data_size, isize (*compare)(void*, void*));
|
||||
|
||||
void prioq_push(PriorityQueue* prioq, void* data);
|
||||
|
||||
void prioq_pop(PriorityQueue* prioq, void* val);
|
||||
|
||||
void prioq_free(PriorityQueue* prioq);
|
||||
|
||||
#endif // PRIORITY_QUEUE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue