heap sort (groovy)