mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
formatting source-code for 91c9c96cf4
This commit is contained in:
parent
91c9c96cf4
commit
6882b545c7
@ -17,9 +17,9 @@ class MinHeap {
|
|||||||
* \param[in] capacity initial heap capacity
|
* \param[in] capacity initial heap capacity
|
||||||
*/
|
*/
|
||||||
explicit MinHeap(int cap) {
|
explicit MinHeap(int cap) {
|
||||||
heap_size = 0;
|
heap_size = 0;
|
||||||
capacity = cap;
|
capacity = cap;
|
||||||
harr = new int[cap];
|
harr = new int[cap];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** to heapify a subtree with the root at given index
|
/** to heapify a subtree with the root at given index
|
||||||
@ -49,12 +49,9 @@ class MinHeap {
|
|||||||
/** Inserts a new key 'k' */
|
/** Inserts a new key 'k' */
|
||||||
void insertKey(int k);
|
void insertKey(int k);
|
||||||
|
|
||||||
~MinHeap() {
|
~MinHeap() { delete[] harr; }
|
||||||
delete [] harr;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Inserts a new key 'k'
|
// Inserts a new key 'k'
|
||||||
void MinHeap::insertKey(int k) {
|
void MinHeap::insertKey(int k) {
|
||||||
if (heap_size == capacity) {
|
if (heap_size == capacity) {
|
||||||
|
Loading…
Reference in New Issue
Block a user