According to (4) - (6) we create triple heap. Having built a triple heap, we
arrange it to put the maximum on the top. We compare descendants with the
root, according to formulas (4) - (6). As a result of this comparison, in each
iteration of the algorithm, the largest element will be placed on the top. It is the
largest element in the current iteration and we put it off the heap to a sorted
output. Then again we have to arrange the remaining elements. To arrange
elements in a triple heap we again use the formula (3) to smartly begin laying
elements from the first node with children. Built heap will have one element less
than before, because found maximum does not participate in this operation. A
new triple heap is sorted again to place maximum element on the top. Creating a
heap and sorting procedures continue until the entire input is sorted. Presented
implementation of this algorithm is made of tree component algorithms. First
we proceed algorithm 1 and then algorithm 2. The procedures to re-arrange