Final answer:
Heap sort has O(1) space complexity and O(n lg n) worst-case time complexity, but it is not a stable sorting algorithm and does not have O(n) best-case time complexity for already-sorted inputs.
Step-by-step explanation:
The question asks about the properties of the heap sort algorithm. Here is the breakdown of heap sort's properties related to the options provided:
- A) O(1) space complexity (when sorting an array) - This is true because heap sort can be implemented in such a way that it only requires a constant amount of additional space, rearranging the elements within the original array.
- B) O(n lg n) worst-case time complexity - Heap sort guarantees a worst-case time complexity of O(n lg n). This is one of the key advantages of heap sort, making it very useful for large datasets.
- C) Stability - Heap sort is not a stable sort. Stability means that elements with equal keys are left in the same order as they occur in the input. In heap sort, this can't be guaranteed.
- D) O(n) best-case time complexity for already-sorted inputs - Heap sort does not have a best-case time complexity of O(n). It is O(n lg n) for both best and worst cases as it does not recognize already sorted arrays.