in the second phase of the algorithmwe start with an empty sequence and move the boundary between the heap and the sequence from right to leftone step at time at step ifor nwe remove maximum element from the heap and store it at index in generalwe say that sorting algorithm is in-place if it uses only small amount of memory in addition to the sequence storing the objects to be sorted the variation of heap-sort above qualifies as in-placeinstead of transferring elements out of the sequence and then back inwe simply rearrange them we illustrate the second phase of in-place heap-sort in figure ( ( ( ( ( ( figure phase of an in-place heap-sort the heap portion of each sequence representation is highlighted the binary tree that each sequence (implicitlyrepresents is diagrammed with the most recent path of down-heap bubbling highlighted