solved p2 with heap sort