Changed dependent ifs to if trees in heap-sorts