Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > PriorityQueue
view PriorityQueue.h @ 0:9ecc993a29ea
initial heap implementation
| author | hausers |
|---|---|
| date | Thu, 09 Feb 2012 11:48:03 +0100 |
| parents | |
| children | b0195491f167 500d0e2fabfb |
line source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: hausers@cs.tu-berlin.de
6 */
8 #ifndef _PRIORITY_QUEUE_H
9 #define _PRIORITY_QUEUE_H
11 #include <stdbool.h>
13 typedef struct _PrioQueueStruc PrioQueueStruc;
14 typedef struct _heapNode heapNode;
16 struct _heapNode {
17 int key;
18 void *val;
19 };
21 struct _PrioQueueStruc {
22 int size;
23 int maxSize;
25 heapNode *data;
26 };
28 PrioQueueStruc* makeVMSPrioQ();
29 void* getFirstPrioQ (PrioQueueStruc *Q);
30 void* popPrioQ (PrioQueueStruc *Q);
31 bool insertPrioQ (void *val, int key, PrioQueueStruc *Q);
32 void freePrioQ (PrioQueueStruc *Q);
34 #ifdef DEBUG
35 void printPrioQ (PrioQueueStruc *Q);
36 void swap (PrioQueueStruc *Q, int a, int b);
37 #endif
40 #endif
