heap.h

来自「堆排序算法」· C头文件 代码 · 共 40 行

H
40
字号


#ifndef HEAP_H
#define HEAP_H

typedef int Type;
class Heap
{
private:
	Type * array;
	int MaxSize,Nel;
	//最大堆容量, nel 现在堆有的元素个数
	void Adjust(Type a[],int i,int n);
public:
	Heap(int MSize):MaxSize(MSize)
	{
		array = new Type[MaxSize + 1];
		Nel = 0;
	}
	~Heap()
	{
		delete []array;
	}

	bool Insert(Type item);
	//insert item
	bool DelMax(Type & item);
	//delete the maximum
};










#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?