PIE exercise on turning a unordered tree into a heap using an array