Just a sample implementation of a HeapSort algorithm using a custom MaxHeap.
Heap is a data structure that allows access to maximum element in a set in constant time, while allowing retrieval (pop) of maximum element in O(lgN). It also allows insertion in O(lgN). Thus it can be used to perform an inplace sort in O(NlgN) time.
Please keep in mind that I implemented this as a quick mental exercise. Do not use this in production unless you know what you are doing.
Implementation is in Objective-C using a Xcode project.