summaryrefslogtreecommitdiff
path: root/include/FHeap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/FHeap.h')
-rw-r--r--include/FHeap.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/FHeap.h b/include/FHeap.h
new file mode 100644
index 0000000..ac58a6d
--- /dev/null
+++ b/include/FHeap.h
@@ -0,0 +1,40 @@
+#ifndef __FHEAP_H__
+#define __FHEAP_H__
+#include <PCommon.h>
+#define DFMAX 128
+
+#ifdef __cplusplus
+typedef class FHeap:public PriorityList {
+ private:
+ FHeap * Father, *Child, *Left, *Right;
+ int Degree;
+ bool Mark;
+
+ void Link(FHeap * x);
+ void Rebuild(void);
+ FHeap(Key_t IKey, Datas_t const &IDatas); // Insert
+ FHeap *Insert(FHeap * x);
+ void Cut(FHeap * x, FHeap * y);
+ void CascadeCut(FHeap * y);
+
+ public:
+ FHeap(void); // Constructor
+ ~FHeap(void); // Destructor
+
+ virtual int rn(void);
+
+ virtual void Dump(ostream & os);
+ void RDump(ostream & os);
+ virtual bool IsEmpty(void);
+
+ virtual Cell Min(void);
+ virtual Cell Insert(Key_t IKey, Datas_t const &IDatas);
+ virtual Key_t Extract_Min(Datas_t & Datas);
+ virtual PriorityList *Union(PriorityList * P);
+ virtual bool Lower_Key(Cell x, Key_t NKey);
+ virtual Key_t Delete(Datas_t & Datas, Cell x);
+} FHeap;
+#else
+#error This librairy will only compile with a C++ compiler.
+#endif
+#endif