implement heap sort in C