maxheap4.cpp
来自「数据结构c++语言描述 Borland C++实现」· C++ 代码 · 共 31 行
CPP
31 行
#include <iostream.h>
#include "maxheap4.h"
void main(void)
{
MaxHeap<int> H(15);
int x;
H.Insert(10).Insert(20).Insert(5).Insert(3);
H.Insert(30).Insert(15).Insert(6).Insert(4);
H.Insert(9).Insert(11).Insert(1).Insert(50);
cout << "Elements in array order" << endl;
H.Output();
H.DeleteMax(x);
cout << "Deleted max element " << x << endl;
cout << "Elements in array order" << endl;
H.Output();
H.DeleteMax(x);
cout << "Deleted max element " << x << endl;
cout << "Elements in array order" << endl;
H.Output();
H.DeleteMax(x);
cout << "Deleted max element " << x << endl;
cout << "Elements in array order" << endl;
H.Output();
H.DeleteMax(x);
cout << "Deleted max element " << x << endl;
cout << "Elements in array order" << endl;
H.Output();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?