implement heap sort in ruby