diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/BHeap.h | 20 | ||||
-rw-r--r-- | include/BinHeap.h | 36 | ||||
-rw-r--r-- | include/FHeap.h | 13 | ||||
-rw-r--r-- | include/HTree.h | 18 | ||||
-rw-r--r-- | include/Hash.h | 9 | ||||
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/PTypes.h | 8 | ||||
-rw-r--r-- | include/SList.h | 3 |
8 files changed, 68 insertions, 41 deletions
diff --git a/include/BHeap.h b/include/BHeap.h index ab63852..d67ab29 100644 --- a/include/BHeap.h +++ b/include/BHeap.h @@ -10,10 +10,10 @@ class BHeap:public PriorityList { BHeap *Father, *Child, *Brother; CList *FP; - void Link(BHeap * z); - void Merge(BHeap * H); + void Link(BHeap * z); + void Merge(BHeap * H); BHeap(Key_t IKey, Datas_t const &IDatas); // Insert - Cell Insert(BHeap * x); + Cell Insert(BHeap * x); public: BHeap(void); // Constructor @@ -22,15 +22,15 @@ class BHeap:public PriorityList { virtual Key_t ReadKey(Cell C); virtual Datas_t ReadDatas(Cell C); - virtual void Dump(ostream & os); + virtual void Dump(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); + 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); }; #else #error This librairy will only compile with a C++ compiler. diff --git a/include/BinHeap.h b/include/BinHeap.h new file mode 100644 index 0000000..8273365 --- /dev/null +++ b/include/BinHeap.h @@ -0,0 +1,36 @@ +#ifndef __BINHEAP_H__ +#define __BINHEAP_H__ +#include <PCommon.h> + +#define GRANUL 8 + +struct binheap_t { + Key_t Key; + Datas_t Datas; +}; + +#ifdef __cplusplus +typedef class BinHeap:public PriorityList { private: + void PackUp(int i); + public: + BinHeap(void); // Constructor + ~BinHeap(void); // Destructor + + virtual int rn(void); + + virtual void Dump(ostream & os); + virtual bool IsEmpty(void); + virtual Key_t ReadKey(Cell C); + virtual Datas_t ReadDatas(Cell C); + + 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); +} BinHeap; +#else +#error This librairy will only compile with a C++ compiler. +#endif +#endif diff --git a/include/FHeap.h b/include/FHeap.h index ac58a6d..65d9253 100644 --- a/include/FHeap.h +++ b/include/FHeap.h @@ -10,10 +10,10 @@ typedef class FHeap:public PriorityList { int Degree; bool Mark; - void Link(FHeap * x); - void Rebuild(void); + void Link(FHeap * x); + void Rebuild(void); FHeap(Key_t IKey, Datas_t const &IDatas); // Insert - FHeap *Insert(FHeap * x); + FHeap *Insert(FHeap * x); void Cut(FHeap * x, FHeap * y); void CascadeCut(FHeap * y); @@ -24,13 +24,12 @@ typedef class FHeap:public PriorityList { 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 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 PriorityList *Union(PriorityList * P); virtual bool Lower_Key(Cell x, Key_t NKey); virtual Key_t Delete(Datas_t & Datas, Cell x); } FHeap; diff --git a/include/HTree.h b/include/HTree.h index 7a8dea0..18150b1 100644 --- a/include/HTree.h +++ b/include/HTree.h @@ -8,15 +8,15 @@ #ifdef __cplusplus class HTree { -private: - HTree * left, * right; - int freq; - Datas_t objet; -public: - HTree(int n_freq, char * n_objet); - HTree(HTree * n_left, HTree * n_right); - ~HTree(); - ostream & Trace(ostream & os, int d = 0); + private: + HTree * left, *right; + int freq; + Datas_t objet; + public: + HTree(int n_freq, char *n_objet); + HTree(HTree * n_left, HTree * n_right); + ~HTree(); + ostream & Trace(ostream & os, int d = 0); }; #else diff --git a/include/Hash.h b/include/Hash.h deleted file mode 100644 index a8d8c1e..0000000 --- a/include/Hash.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __HASH_H__ -#define __HASH_H__ - -class Hash { - private: - void *table; -}; - -#endif diff --git a/include/Makefile.am b/include/Makefile.am index a2c74d9..c0518e5 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1 +1 @@ -include_HEADERS = PCommon.h PLList.h FHeap.h BHeap.h Hash.h CList.h SList.h PTypes.h +include_HEADERS = PCommon.h PLList.h FHeap.h BHeap.h BinHeap.h CList.h SList.h PTypes.h diff --git a/include/PTypes.h b/include/PTypes.h index 6e4e7b7..418eca5 100644 --- a/include/PTypes.h +++ b/include/PTypes.h @@ -12,10 +12,10 @@ typedef void *Datas_t; typedef void *Cell; enum { - T_PLLIST = 1, - T_BINHEAP, - T_BHEAP, - T_FHEAP + T_PLLIST = 1, + T_BINHEAP, + T_BHEAP, + T_FHEAP }; #endif diff --git a/include/SList.h b/include/SList.h index 845d83a..4407b2b 100644 --- a/include/SList.h +++ b/include/SList.h @@ -6,7 +6,8 @@ #ifdef __cplusplus -class SList:public CList { public: +class SList:public CList { + public: virtual Cell Insert(Key_t IKey, Datas_t const &IDatas); }; |