binary trees of the corresponding array the shaded part of the array indicates the items that are currently part of the array the boldfaced value indicates the next item to be sifted up the tree we have shown it is quite easy to build heap using the same array containing the values that are to be added to the heap similar approach can be used to extract the values from the heap and create sorted array using the array containing the heap rememberwhen the root value is extracted from heapthe value from the rightmost leaf at the lowest level is copied to the root node and then sifted down the tree consider the completed heap in figure (awhen value is extracted from the heapthe last value in the array would be copied to the root node since it corresponds to the rightmost leaf node at the lowest level instead of simply copying this leaf value to the rootwe can swap the two valuesas shown in figure (bthe next step in the process of extracting value from the heap is to remove the leaf node from the heap in an array representationwe do this by reducing counter indicating the number of items in the heap in figure ( )the elements comprising the heap are shown with white background and the value (athe original max-heap (bswap the first and last items in the heap (cremove the last item from the heap (dsift the root value down the tree figure the three steps performed to extract in place single value from the heap