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