Wrote buildHeap