Heap sort in C#