diff --git a/data_structures/binaryheap.cpp b/data_structures/binaryheap.cpp index 2396f2e51..c3a1f5cf6 100644 --- a/data_structures/binaryheap.cpp +++ b/data_structures/binaryheap.cpp @@ -13,13 +13,13 @@ class MinHeap { int heap_size; ///< Current number of elements in min heap public: - /** Constructor: Builds a heap from a given array a[] of given size + /** Constructor: Builds a heap from a given array a[] of given size * \param[in] capacity initial heap capacity */ explicit MinHeap(int cap) { - heap_size = 0; - capacity = cap; - harr = new int[cap]; + heap_size = 0; + capacity = cap; + harr = new int[cap]; } /** to heapify a subtree with the root at given index @@ -49,12 +49,9 @@ class MinHeap { /** Inserts a new key 'k' */ void insertKey(int k); - ~MinHeap() { - delete [] harr; - } + ~MinHeap() { delete[] harr; } }; - // Inserts a new key 'k' void MinHeap::insertKey(int k) { if (heap_size == capacity) {