/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ #ifndef HEAP_H__ #define HEAP_H__ /* usage: the type "Element" for the elements to be stored must be declared elsewere this type must support a compare function like strcmp, with results -1,0,+1 reflecting the ordering relation see "Element.h" and "Element.c" examples */ typedef struct Node *Heap; struct Node { Element info; Heap l; Heap r; }; extern Heap mkEmptyHeap(void); extern Heap mkOneElemHeap(Element e); extern int isEmptyHeap(Heap h); extern Element minElem(Heap h); extern Heap deleteMinElem(Heap h); extern Heap insertElem(Element e, Heap h); extern Heap mergeHeaps(Heap h1, Heap h2); extern int invHeap(Heap h1); #endif