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

📄 minheap.h

📁 经典c++程序的实现
💻 H
字号:
class heap {                 // Min-heap class
private:
  ELEM* Heap;                // Pointer to the heap array
  int size;                  // Maximum size of the heap
  int n;                     // Number of elements now in the heap
  void siftdown(int);        // Put an element in its correct place
public:
  heap(ELEM*, int, int);     // Constructor
  int heapsize() const;      // Return current size of the heap
  bool isLeaf(int) const;    // TRUE if pos is a leaf position
  int leftchild(int) const;  // Return position for left child
  int rightchild(int) const; // Return position for right child
  int parent(int) const;     // Return position for parent of pos
  void insert(const ELEM);   // Insert value into heap
  ELEM removemin();          // Remove minimum value
  ELEM remove(int);          // Remove value at specified position
  void buildheap();          // Heapify contents of Heap
};

⌨️ 快捷键说明

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