brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | #ifndef _BinHeap_H |
| 2 | #define _BinHeap_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | typedef uint8_t ElementType; |
| 7 | struct HeapStruct; |
| 8 | typedef struct HeapStruct *PriorityQueue; |
| 9 | |
| 10 | struct HeapStruct |
| 11 | { |
| 12 | int Capacity; |
| 13 | int Size; |
| 14 | ElementType *Elements; |
| 15 | }; |
| 16 | |
| 17 | // Elements is the number allocated at H->Elements |
| 18 | void Initialize( int Elements, PriorityQueue H ); |
| 19 | // 0 if successful, -1 if full |
| 20 | int Insert( ElementType X, PriorityQueue H ); |
| 21 | void Remove( ElementType X, PriorityQueue H ); |
| 22 | ElementType DeleteMin( PriorityQueue H ); |
| 23 | ElementType GetMin( PriorityQueue H ); |
| 24 | int IsEmpty( PriorityQueue H ); |
| 25 | int IsFull( PriorityQueue H ); |
| 26 | int GetSize( PriorityQueue H ); |
| 27 | |
| 28 | #endif |
| 29 | |