minheap4.cpp
来自「数据结构c++语言描述 Borland C++实现」· C++ 代码 · 共 29 行
CPP
29 行
#include <iostream.h>
#include "minheap4.h"
void main(void)
{
MinHeap<int> H(4);
H.Insert(10).Insert(20).Insert(5).Insert(30);
cout << "Elements in array order" << endl;
H.Output();
H.ChangeMin(2);
cout << "Min element replaced by 2" << endl;
cout << "Elements in array order" << endl;
H.Output();
H.ChangeMin(15);
cout << "Min element replaced by 15" << endl;
cout << "Elements in array order" << endl;
H.Output();
H.ChangeMin(40);
cout << "Min element replaced by 40" << endl;
cout << "Elements in array order" << endl;
H.Output();
H.ChangeMin(25);
cout << "Min element replaced by 1" << endl;
cout << "Elements in array order" << endl;
H.Output();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?