summaryrefslogtreecommitdiff
path: root/include/BinHeap.h
blob: 879267a5b2a6a676de156818f199b65b55309e0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef __BINHEAP_H__
#define __BINHEAP_H__
#include <PCommon.h>
#include <CList.h>

#define GRANUL 8

struct binheap_t {
	Key_t Key;
	Datas_t Datas;
	Cell FP;
};

#ifdef __cplusplus
typedef class BinHeap:public PriorityList { private:
	void PackUp(int i);
	CList *FP;
      public:
	  BinHeap(void);	// Constructor                         
	  virtual ~ 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