diff PriorityQueue.h @ 0:9ecc993a29ea

initial heap implementation
author hausers
date Thu, 09 Feb 2012 11:48:03 +0100
parents
children b0195491f167 500d0e2fabfb
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/PriorityQueue.h	Thu Feb 09 11:48:03 2012 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +/*
     1.5 + *  Copyright 2009 OpenSourceStewardshipFoundation.org
     1.6 + *  Licensed under GNU General Public License version 2
     1.7 + *
     1.8 + * Author: hausers@cs.tu-berlin.de
     1.9 + */
    1.10 +
    1.11 +#ifndef _PRIORITY_QUEUE_H
    1.12 +#define _PRIORITY_QUEUE_H
    1.13 +
    1.14 +#include <stdbool.h>
    1.15 +
    1.16 +typedef struct _PrioQueueStruc PrioQueueStruc;
    1.17 +typedef struct _heapNode heapNode;
    1.18 +
    1.19 +struct _heapNode {
    1.20 +	int key;
    1.21 +	void *val;
    1.22 +};
    1.23 +
    1.24 +struct _PrioQueueStruc {
    1.25 +	int size;
    1.26 +	int maxSize;
    1.27 +	
    1.28 +	heapNode *data;
    1.29 +};
    1.30 +
    1.31 +PrioQueueStruc* makeVMSPrioQ();
    1.32 +void* getFirstPrioQ (PrioQueueStruc *Q);
    1.33 +void* popPrioQ (PrioQueueStruc *Q);
    1.34 +bool insertPrioQ (void *val, int key, PrioQueueStruc *Q);
    1.35 +void freePrioQ (PrioQueueStruc *Q);
    1.36 +
    1.37 +#ifdef DEBUG
    1.38 +void printPrioQ (PrioQueueStruc *Q);
    1.39 +void swap (PrioQueueStruc *Q, int a, int b);
    1.40 +#endif
    1.41 +
    1.42 +
    1.43 +#endif
    1.44 +