⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 minheap.cpp

📁 data structures, algorithms and Application书的源代码
💻 CPP
字号:
// test min heap class

#include <iostream.h>
#include "minheap.h"

void main(void)
{
   MinHeap<int> H(4);
   int x;
   H.Insert(10).Insert(20).Insert(5);
   cout << "Elements in array order" << endl;
   H.Output();
   try {H.Insert(15);
        cout << "Insert of 15  succeeded" << endl;
        H.Insert(30);
        cout << "Insert of 30  succeeded" << endl;}
   catch (NoMem)
      {cout << "An insert has failed"  << endl;}
   cout << "Elements in array order" << endl;
   H.Output();
   cout << "The min element is " << H.Min() << endl;
   H.DeleteMin(x);
   cout << "Deleted min element " << x << endl;
   H.DeleteMin(x);
   cout << "Deleted min element " << x << endl;
   cout << "Elements in array order" << endl;
   H.Output();
}

⌨️ 快捷键说明

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