Better implementation of hbalTree.
99HP: problem 61
99HP: problem 61a
99HP: problem 62
99HP: problem 62b