Replace recursive heapfiy() with a loop impl.