Added heap data structure and sorting method