heap.h

Go to the documentation of this file.
00001 
00007 #include "elements.h"
00008 
00009 class heapRecord
00010 { public:
00011   short deleted; // boolean
00012   InfoRecord *info;
00013 };
00014 
00015 class heapIterator{
00016 public:
00017   int next;
00018 };
00019 
00020 class minHeap
00021 {
00022 private:
00023   heapRecord *h;
00024   int count;
00025   int size;
00026   void swap(int i, int j) 
00027     {
00028       heapRecord temp = h[i];
00029       h[i] = h[j];
00030       h[j] = temp;
00031     }
00032   
00033 public:
00034   minHeap(int size);
00035   ~minHeap();
00036   int numElements();
00037   int insert(InfoRecord *);
00038   InfoRecord *deleteMin();
00039   InfoRecord *iterator(heapIterator *);
00040   InfoRecord *next(heapIterator *);
00041 };
00042 
00043 class maxHeap
00044 {
00045 private:
00046   heapRecord *h;
00047   int count;
00048   int size;
00049 
00050   void swap(int i, int j) 
00051     {
00052       heapRecord temp = h[i];
00053       h[i] = h[j];
00054       h[j] = temp;
00055     }
00056   
00057 public:  
00058   maxHeap(int size);
00059   ~maxHeap();
00060   int numElements();
00061   int insert(InfoRecord *);
00062   InfoRecord *deleteMax();
00063   InfoRecord *iterator(heapIterator *);
00064   InfoRecord *next(heapIterator *);
00065 };
00066 

Generated on Tue Nov 21 01:17:13 2017 for NAMD by  doxygen 1.4.7