linear time buildHeap