📄 fig06_04.cpp
字号:
template <typename Comparable>
class BinaryHeap
{
public:
explicit BinaryHeap( int capacity = 100 );
explicit BinaryHeap( const vector<Comparable> & items );
bool isEmpty( ) const;
const Comparable & findMin( ) const;
void insert( const Comparable & x );
void deleteMin( );
void deleteMin( Comparable & minItem );
void makeEmpty( );
private:
int currentSize; // Number of elements in heap
vector<Comparable> array; // The heap array
void buildHeap( );
void percolateDown( int hole );
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -