Show the worked solutionHeapsort builds a max-heap inside the input array, then repeatedly swaps the root with the last element of the heap and sifts down. All of this is done by swaps within the array, and sift-down can be written iteratively.\[\text{Extra space}=O(1)\ \text{(a few index variables).}\]Heapsort is an in-place sorting algorithm, unlike merge sort, which needs \(O(n)\) auxiliary space.Answer: A
GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com