comparison PriorityQueue.h @ 0:9ecc993a29ea

initial heap implementation
author hausers
date Thu, 09 Feb 2012 11:48:03 +0100
parents
children b0195491f167 500d0e2fabfb
comparison
equal deleted inserted replaced
-1:000000000000 0:a9b6426f2977
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: hausers@cs.tu-berlin.de
6 */
7
8 #ifndef _PRIORITY_QUEUE_H
9 #define _PRIORITY_QUEUE_H
10
11 #include <stdbool.h>
12
13 typedef struct _PrioQueueStruc PrioQueueStruc;
14 typedef struct _heapNode heapNode;
15
16 struct _heapNode {
17 int key;
18 void *val;
19 };
20
21 struct _PrioQueueStruc {
22 int size;
23 int maxSize;
24
25 heapNode *data;
26 };
27
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);
33
34 #ifdef DEBUG
35 void printPrioQ (PrioQueueStruc *Q);
36 void swap (PrioQueueStruc *Q, int a, int b);
37 #endif
38
39
40 #endif
41