Heap Sort Python

heap sort python

 Basics points of heapsort

  • Heapsort is a sorting type algorithm that sorted a group of elements using comparison-based algorithms. 
  • The process is done using the heapsort algorithm is called heapify
  • It can be thought that heapsort is the modified advanced version of the others algorithm like selection sort and insertion sort. Most of the heapsort implementation is based on the binary data structure. 
  • When the heap sort follows the binary heap data structure, then it is called a binary heapify. A binary data structure is a tree-based data structure. 
  • max-heap is a process of heapsort where each internal node (parents) value is greater or equal than its child values in the Binary data structure tree.
  • In contrast, a min-heap is a process where each internal node (parents) value is less or equal than its child values. 
  • There are many types of heap sort's implementation available on the internet. Those are Bottom-upFloyd's heap (sift down and sift up). Variants of heap sort are Max heapifyMin heapify, and Max-Min heapify.
  • Heapsort principally completes the process of quicksort.
  • Heapsort algorithm is a very efficient in-place comparison-based sorting algorithm.
  • Read the time complexity of heapsort


The below implementation of the heapsort is based on the max-heapify process and also the process is followed the object-oriented language steps. The python language makes the implementation easy and readable. Additional comments with code have been attached to the code for the proper understanding of the beginners. The code not only shows the sorted list but also shows all steps for sorting an array.


Heap Sort Python (using Max-heap)


# import all required packages
from collections import defaultdict
from copy import deepcopy

# initializing 'heap_steps' to printed all heap steps
heap_steps = defaultdict()

# clearing heap to sort another array
def Reset_Heap_Steps():
heap_steps.clear()

# constructing the structure of a heap
class Heap_Structure:
# input array to be processed
array = []
# size of the input array
size_of_array = 0
# Depth of the heap represent the size of heap
size_of_heap = 0
# constructor of the heap class
def __init__(self, array, size_of_array, size_of_heap):
self.array = array
self.size_of_array = size_of_array
self.size_of_heap = size_of_heap

# This algorithm is based on the Max heapifying process
def Max_Heapifying(heap, i):
# checking the largest index in the array
largest_idx = i
# initializing parents and child parameter
l_idx, r_idx = None, None

if 2 * i + 1 < heap.size_of_heap:
l_idx = 2 * i + 1

if 2 * (i + 1) < heap.size_of_heap:
r_idx = 2 * (i + 1)

# Checking parental node values
if l_idx is not None and heap.array[l_idx] > heap.array[i]:
largest_idx = l_idx

# checking the child node values
if r_idx is not None and heap.array[r_idx] > heap.array[largest_idx]:
largest_idx = r_idx

# recursively calling the max heapifying process untill the largest index filled up with the large value
if largest_idx != i:
heap.array[i], heap.array[largest_idx] = heap.array[largest_idx], heap.array[i]
Max_Heapifying(heap, largest_idx)


# sending the input array to the max heapify process
# If the max heapifying process with input array's value valid, then construct it
def build_max_heap(heap):
for i in range(int(heap.size_of_array / 2), -1, -1):
Max_Heapifying(heap, i)


# This method sorting the array
def heapsort(array):
n = 1
Reset_Heap_Steps()

size_of_array = len(array)
size_of_heap = size_of_array

heap = Heap_Structure(array, size_of_array, size_of_heap)

build_max_heap(heap)

# cloning the built heap structure for further process
heap_steps[n] = deepcopy(heap)

for i in range(heap.size_of_array - 1, 0, -1):
heap.array[i], heap.array[0] = heap.array[0], heap.array[i]
heap.size_of_heap -= 1

Max_Heapifying(heap, 0)

n += 1
heap_steps[n] = deepcopy(heap)

return heap.array

# get the all steps to be store in the heap_steps variable
def get_number_of_heap_steps():
return heap_steps


if __name__ == '__main__':
# Taking the input array to be sorted
array= list(map(int, input("Enter the numbers to be sorted: ").split()))
# send the array to be sorted
sorted_list = heapsort(array)

# Get the number of heap steps
num_heap_steps = len(get_number_of_heap_steps().items())

# process the number of heap steps to be printed
for i, heap_step in get_number_of_heap_steps().items():
heap_list = heap_step.array[:num_heap_steps - i + 1]
non_heap_list = heap_step.array[num_heap_steps - i + 1:]

if non_heap_list != []:
print('Heap step {0}'.format(i).ljust(13), ':',str(heap_list)[:-1], ',',str(non_heap_list)[1:])
else:
print('Heap step {0}'.format(i).ljust(13), ':',str(heap_list))
else:
print()

print('Heap Sorted List :', sorted_list)


Input sample:

Enter the numbers to be sorted: 86 80 76 69 47 52 5 36 35 98 94 11 96 22 17 62 28 74


Output sample:

Heap step 1   : [98, 94, 96, 74, 86, 76, 22, 62, 69, 47, 80, 11, 52, 5, 17, 36, 28, 35]

Heap step 2   : [96, 94, 76, 74, 86, 52, 22, 62, 69, 47, 80, 11, 35, 5, 17, 36, 28 , 98]

Heap step 3   : [94, 86, 76, 74, 80, 52, 22, 62, 69, 47, 28, 11, 35, 5, 17, 36 , 96, 98]

Heap step 4   : [86, 80, 76, 74, 47, 52, 22, 62, 69, 36, 28, 11, 35, 5, 17 , 94, 96, 98]

Heap step 5   : [80, 74, 76, 69, 47, 52, 22, 62, 17, 36, 28, 11, 35, 5 , 86, 94, 96, 98]

Heap step 6   : [76, 74, 52, 69, 47, 35, 22, 62, 17, 36, 28, 11, 5 , 80, 86, 94, 96, 98]

Heap step 7   : [74, 69, 52, 62, 47, 35, 22, 5, 17, 36, 28, 11 , 76, 80, 86, 94, 96, 98]

Heap step 8   : [69, 62, 52, 17, 47, 35, 22, 5, 11, 36, 28 , 74, 76, 80, 86, 94, 96, 98]

Heap step 9   : [62, 47, 52, 17, 36, 35, 22, 5, 11, 28 , 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 10  : [52, 47, 35, 17, 36, 28, 22, 5, 11 , 62, 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 11  : [47, 36, 35, 17, 11, 28, 22, 5 , 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 12  : [36, 17, 35, 5, 11, 28, 22 , 47, 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 13  : [35, 17, 28, 5, 11, 22 , 36, 47, 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 14  : [28, 17, 22, 5, 11 , 35, 36, 47, 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 15  : [22, 17, 11, 5 , 28, 35, 36, 47, 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 16  : [17, 5, 11 , 22, 28, 35, 36, 47, 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 17  : [11, 5 , 17, 22, 28, 35, 36, 47, 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]

Heap step 18  : [5 , 11, 17, 22, 28, 35, 36, 47, 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]


Heap Sorted List   : [5, 11, 17, 22, 28, 35, 36, 47, 52, 62, 69, 74, 76, 80, 86, 94, 96, 98]



Sort 0 to 99 using the above heap sort implementation and also show the steps

Input Sample:

Enter the numbers to be sorted: 86 88 76 69 41 52 5 36 72 35 98 94 11 96 22 17 62 28 74 27 58 45 44 53 77 40 13 90 3 21 2 37 87 83 80 10 18 0 34 60 12 9 38 66 89 23 78 31 42 68 57 64 65 1 97 6 46 85 4 61 79 25 33 24 91 14 16 92 15 70 93 19 26 47 67 71 39 43 55 54 81 29 82 59 32 49 95 56 30 48 20 51 84 75 50 73 8 63 99 7


Output Sample:

Heap step 1   : [99, 98, 97, 93, 95, 94, 96, 92, 74, 88, 89, 86, 76, 90, 79, 91, 83, 67, 72, 82, 59, 66, 84, 73, 77, 65, 13, 46, 85, 61, 33, 37, 87, 69, 80, 26, 47, 71, 55, 81, 29, 35, 58, 56, 48, 51, 78, 52, 63, 68, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 16, 36, 15, 70, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 60, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44, 23, 75, 50, 31, 8, 53, 42, 7]

Heap step 2   : [98, 95, 97, 93, 89, 94, 96, 92, 74, 88, 84, 86, 76, 90, 79, 91, 83, 67, 72, 82, 59, 66, 78, 73, 77, 65, 13, 46, 85, 61, 33, 37, 87, 69, 80, 26, 47, 71, 55, 81, 29, 35, 58, 56, 48, 51, 75, 52, 63, 68, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 16, 36, 15, 70, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 60, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44, 23, 7, 50, 31, 8, 53, 42 , 99]

Heap step 3   : [97, 95, 96, 93, 89, 94, 90, 92, 74, 88, 84, 86, 76, 85, 79, 91, 83, 67, 72, 82, 59, 66, 78, 73, 77, 65, 13, 46, 42, 61, 33, 37, 87, 69, 80, 26, 47, 71, 55, 81, 29, 35, 58, 56, 48, 51, 75, 52, 63, 68, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 16, 36, 15, 70, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 60, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44, 23, 7, 50, 31, 8, 53 , 98, 99]

Heap step 4   : [96, 95, 94, 93, 89, 86, 90, 92, 74, 88, 84, 77, 76, 85, 79, 91, 83, 67, 72, 82, 59, 66, 78, 73, 68, 65, 13, 46, 42, 61, 33, 37, 87, 69, 80, 26, 47, 71, 55, 81, 29, 35, 58, 56, 48, 51, 75, 52, 63, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 16, 36, 15, 70, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 60, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44, 23, 7, 50, 31, 8 , 97, 98, 99]

Heap step 5   : [95, 93, 94, 92, 89, 86, 90, 91, 74, 88, 84, 77, 76, 85, 79, 87, 83, 67, 72, 82, 59, 66, 78, 73, 68, 65, 13, 46, 42, 61, 33, 37, 16, 69, 80, 26, 47, 71, 55, 81, 29, 35, 58, 56, 48, 51, 75, 52, 63, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 70, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 60, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44, 23, 7, 50, 31 , 96, 97, 98, 99]

Heap step 6   : [94, 93, 90, 92, 89, 86, 85, 91, 74, 88, 84, 77, 76, 46, 79, 87, 83, 67, 72, 82, 59, 66, 78, 73, 68, 65, 13, 31, 42, 61, 33, 37, 16, 69, 80, 26, 47, 71, 55, 81, 29, 35, 58, 56, 48, 51, 75, 52, 63, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 70, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 60, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44, 23, 7, 50 , 95, 96, 97, 98, 99]

Heap step 7   : [93, 92, 90, 91, 89, 86, 85, 87, 74, 88, 84, 77, 76, 46, 79, 50, 83, 67, 72, 82, 59, 66, 78, 73, 68, 65, 13, 31, 42, 61, 33, 37, 16, 69, 80, 26, 47, 71, 55, 81, 29, 35, 58, 56, 48, 51, 75, 52, 63, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 70, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 60, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44, 23, 7 , 94, 95, 96, 97, 98, 99]

Heap step 8   : [92, 91, 90, 87, 89, 86, 85, 83, 74, 88, 84, 77, 76, 46, 79, 50, 80, 67, 72, 82, 59, 66, 78, 73, 68, 65, 13, 31, 42, 61, 33, 37, 16, 69, 70, 26, 47, 71, 55, 81, 29, 35, 58, 56, 48, 51, 75, 52, 63, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 60, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44, 23 , 93, 94, 95, 96, 97, 98, 99]

Heap step 9   : [91, 89, 90, 87, 88, 86, 85, 83, 74, 82, 84, 77, 76, 46, 79, 50, 80, 67, 72, 81, 59, 66, 78, 73, 68, 65, 13, 31, 42, 61, 33, 37, 16, 69, 70, 26, 47, 71, 55, 60, 29, 35, 58, 56, 48, 51, 75, 52, 63, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 23, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20, 44 , 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 10  : [90, 89, 86, 87, 88, 77, 85, 83, 74, 82, 84, 73, 76, 46, 79, 50, 80, 67, 72, 81, 59, 66, 78, 63, 68, 65, 13, 31, 42, 61, 33, 37, 16, 69, 70, 26, 47, 71, 55, 60, 29, 35, 58, 56, 48, 51, 75, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 23, 27, 12, 9, 32, 49, 38, 41, 30, 45, 20 , 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 11  : [89, 88, 86, 87, 84, 77, 85, 83, 74, 82, 78, 73, 76, 46, 79, 50, 80, 67, 72, 81, 59, 66, 75, 63, 68, 65, 13, 31, 42, 61, 33, 37, 16, 69, 70, 26, 47, 71, 55, 60, 29, 35, 58, 56, 48, 51, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 62, 19, 10, 28, 18, 0, 39, 43, 34, 54, 23, 27, 12, 9, 32, 49, 38, 41, 30, 45 , 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 12  : [88, 87, 86, 83, 84, 77, 85, 80, 74, 82, 78, 73, 76, 46, 79, 50, 70, 67, 72, 81, 59, 66, 75, 63, 68, 65, 13, 31, 42, 61, 33, 37, 16, 69, 62, 26, 47, 71, 55, 60, 29, 35, 58, 56, 48, 51, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 39, 43, 34, 54, 23, 27, 12, 9, 32, 49, 38, 41, 30 , 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 13  : [87, 84, 86, 83, 82, 77, 85, 80, 74, 81, 78, 73, 76, 46, 79, 50, 70, 67, 72, 60, 59, 66, 75, 63, 68, 65, 13, 31, 42, 61, 33, 37, 16, 69, 62, 26, 47, 71, 55, 54, 29, 35, 58, 56, 48, 51, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 39, 43, 34, 30, 23, 27, 12, 9, 32, 49, 38, 41 , 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 14  : [86, 84, 85, 83, 82, 77, 79, 80, 74, 81, 78, 73, 76, 46, 61, 50, 70, 67, 72, 60, 59, 66, 75, 63, 68, 65, 13, 31, 42, 41, 33, 37, 16, 69, 62, 26, 47, 71, 55, 54, 29, 35, 58, 56, 48, 51, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 39, 43, 34, 30, 23, 27, 12, 9, 32, 49, 38 , 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 15  : [85, 84, 79, 83, 82, 77, 61, 80, 74, 81, 78, 73, 76, 46, 41, 50, 70, 67, 72, 60, 59, 66, 75, 63, 68, 65, 13, 31, 42, 38, 33, 37, 16, 69, 62, 26, 47, 71, 55, 54, 29, 35, 58, 56, 48, 51, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 39, 43, 34, 30, 23, 27, 12, 9, 32, 49 , 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 16  : [84, 83, 79, 80, 82, 77, 61, 70, 74, 81, 78, 73, 76, 46, 41, 50, 69, 67, 72, 60, 59, 66, 75, 63, 68, 65, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 71, 55, 54, 29, 35, 58, 56, 48, 51, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 39, 43, 34, 30, 23, 27, 12, 9, 32 , 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 17  : [83, 82, 79, 80, 81, 77, 61, 70, 74, 60, 78, 73, 76, 46, 41, 50, 69, 67, 72, 54, 59, 66, 75, 63, 68, 65, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 71, 55, 32, 29, 35, 58, 56, 48, 51, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 39, 43, 34, 30, 23, 27, 12, 9 , 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 18  : [82, 81, 79, 80, 78, 77, 61, 70, 74, 60, 75, 73, 76, 46, 41, 50, 69, 67, 72, 54, 59, 66, 51, 63, 68, 65, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 71, 55, 32, 29, 35, 58, 56, 48, 9, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 39, 43, 34, 30, 23, 27, 12 , 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 19  : [81, 80, 79, 74, 78, 77, 61, 70, 72, 60, 75, 73, 76, 46, 41, 50, 69, 67, 71, 54, 59, 66, 51, 63, 68, 65, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 39, 55, 32, 29, 35, 58, 56, 48, 9, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 12, 43, 34, 30, 23, 27 , 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 20  : [80, 78, 79, 74, 75, 77, 61, 70, 72, 60, 66, 73, 76, 46, 41, 50, 69, 67, 71, 54, 59, 56, 51, 63, 68, 65, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 39, 55, 32, 29, 35, 58, 27, 48, 9, 20, 52, 44, 53, 57, 64, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 12, 43, 34, 30, 23 , 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 21  : [79, 78, 77, 74, 75, 76, 61, 70, 72, 60, 66, 73, 65, 46, 41, 50, 69, 67, 71, 54, 59, 56, 51, 63, 68, 64, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 39, 55, 32, 29, 35, 58, 27, 48, 9, 20, 52, 44, 53, 57, 23, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 12, 43, 34, 30 , 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 22  : [78, 75, 77, 74, 66, 76, 61, 70, 72, 60, 56, 73, 65, 46, 41, 50, 69, 67, 71, 54, 59, 48, 51, 63, 68, 64, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 39, 55, 32, 29, 35, 58, 27, 30, 9, 20, 52, 44, 53, 57, 23, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 12, 43, 34 , 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 23  : [77, 75, 76, 74, 66, 73, 61, 70, 72, 60, 56, 68, 65, 46, 41, 50, 69, 67, 71, 54, 59, 48, 51, 63, 57, 64, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 39, 55, 32, 29, 35, 58, 27, 30, 9, 20, 52, 44, 53, 34, 23, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 12, 43 , 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 24  : [76, 75, 73, 74, 66, 68, 61, 70, 72, 60, 56, 63, 65, 46, 41, 50, 69, 67, 71, 54, 59, 48, 51, 52, 57, 64, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 39, 55, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 23, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0, 12 , 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 25  : [75, 74, 73, 72, 66, 68, 61, 70, 71, 60, 56, 63, 65, 46, 41, 50, 69, 67, 55, 54, 59, 48, 51, 52, 57, 64, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 47, 39, 12, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 23, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 28, 18, 0 , 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 26  : [74, 72, 73, 71, 66, 68, 61, 70, 67, 60, 56, 63, 65, 46, 41, 50, 69, 47, 55, 54, 59, 48, 51, 52, 57, 64, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 28, 39, 12, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 23, 40, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 0, 18 , 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 27  : [73, 72, 68, 71, 66, 65, 61, 70, 67, 60, 56, 63, 64, 46, 41, 50, 69, 47, 55, 54, 59, 48, 51, 52, 57, 40, 13, 31, 42, 38, 33, 37, 16, 49, 62, 26, 28, 39, 12, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 23, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 45, 19, 10, 0 , 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 28  : [72, 71, 68, 70, 66, 65, 61, 69, 67, 60, 56, 63, 64, 46, 41, 50, 62, 47, 55, 54, 59, 48, 51, 52, 57, 40, 13, 31, 42, 38, 33, 37, 16, 49, 45, 26, 28, 39, 12, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 23, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 36, 15, 7, 0, 19, 10 , 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 29  : [71, 70, 68, 69, 66, 65, 61, 62, 67, 60, 56, 63, 64, 46, 41, 50, 49, 47, 55, 54, 59, 48, 51, 52, 57, 40, 13, 31, 42, 38, 33, 37, 16, 36, 45, 26, 28, 39, 12, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 23, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 10, 15, 7, 0, 19 , 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 30  : [70, 69, 68, 67, 66, 65, 61, 62, 55, 60, 56, 63, 64, 46, 41, 50, 49, 47, 39, 54, 59, 48, 51, 52, 57, 40, 13, 31, 42, 38, 33, 37, 16, 36, 45, 26, 28, 19, 12, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 23, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 24, 17, 14, 8, 10, 15, 7, 0 , 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 31  : [69, 67, 68, 62, 66, 65, 61, 50, 55, 60, 56, 63, 64, 46, 41, 37, 49, 47, 39, 54, 59, 48, 51, 52, 57, 40, 13, 31, 42, 38, 33, 24, 16, 36, 45, 26, 28, 19, 12, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 23, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 0, 17, 14, 8, 10, 15, 7 , 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 32  : [68, 67, 65, 62, 66, 64, 61, 50, 55, 60, 56, 63, 40, 46, 41, 37, 49, 47, 39, 54, 59, 48, 51, 52, 57, 23, 13, 31, 42, 38, 33, 24, 16, 36, 45, 26, 28, 19, 12, 32, 29, 35, 58, 27, 30, 9, 20, 43, 44, 53, 34, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 0, 17, 14, 8, 10, 15 , 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 33  : [67, 66, 65, 62, 60, 64, 61, 50, 55, 59, 56, 63, 40, 46, 41, 37, 49, 47, 39, 54, 58, 48, 51, 52, 57, 23, 13, 31, 42, 38, 33, 24, 16, 36, 45, 26, 28, 19, 12, 32, 29, 35, 15, 27, 30, 9, 20, 43, 44, 53, 34, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 0, 17, 14, 8, 10 , 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 34  : [66, 62, 65, 55, 60, 64, 61, 50, 47, 59, 56, 63, 40, 46, 41, 37, 49, 28, 39, 54, 58, 48, 51, 52, 57, 23, 13, 31, 42, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 32, 29, 35, 15, 27, 30, 9, 20, 43, 44, 53, 34, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 0, 17, 14, 8 , 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 35  : [65, 62, 64, 55, 60, 63, 61, 50, 47, 59, 56, 57, 40, 46, 41, 37, 49, 28, 39, 54, 58, 48, 51, 52, 53, 23, 13, 31, 42, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 32, 29, 35, 15, 27, 30, 9, 20, 43, 44, 8, 34, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 0, 17, 14 , 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 36  : [64, 62, 63, 55, 60, 57, 61, 50, 47, 59, 56, 53, 40, 46, 41, 37, 49, 28, 39, 54, 58, 48, 51, 52, 34, 23, 13, 31, 42, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 32, 29, 35, 15, 27, 30, 9, 20, 43, 44, 8, 14, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 0, 17 , 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 37  : [63, 62, 61, 55, 60, 57, 46, 50, 47, 59, 56, 53, 40, 42, 41, 37, 49, 28, 39, 54, 58, 48, 51, 52, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 32, 29, 35, 15, 27, 30, 9, 20, 43, 44, 8, 14, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2, 0 , 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 38  : [62, 60, 61, 55, 59, 57, 46, 50, 47, 58, 56, 53, 40, 42, 41, 37, 49, 28, 39, 54, 35, 48, 51, 52, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 32, 29, 0, 15, 27, 30, 9, 20, 43, 44, 8, 14, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25, 2 , 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 39  : [61, 60, 57, 55, 59, 53, 46, 50, 47, 58, 56, 52, 40, 42, 41, 37, 49, 28, 39, 54, 35, 48, 51, 44, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 32, 29, 0, 15, 27, 30, 9, 20, 43, 2, 8, 14, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21, 25 , 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 40  : [60, 59, 57, 55, 58, 53, 46, 50, 47, 54, 56, 52, 40, 42, 41, 37, 49, 28, 39, 32, 35, 48, 51, 44, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 25, 29, 0, 15, 27, 30, 9, 20, 43, 2, 8, 14, 7, 18, 1, 11, 6, 5, 3, 4, 22, 21 , 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 41  : [59, 58, 57, 55, 56, 53, 46, 50, 47, 54, 51, 52, 40, 42, 41, 37, 49, 28, 39, 32, 35, 48, 21, 44, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 25, 29, 0, 15, 27, 30, 9, 20, 43, 2, 8, 14, 7, 18, 1, 11, 6, 5, 3, 4, 22 , 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 42  : [58, 56, 57, 55, 54, 53, 46, 50, 47, 35, 51, 52, 40, 42, 41, 37, 49, 28, 39, 32, 22, 48, 21, 44, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 25, 29, 0, 15, 27, 30, 9, 20, 43, 2, 8, 14, 7, 18, 1, 11, 6, 5, 3, 4 , 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 43  : [57, 56, 53, 55, 54, 52, 46, 50, 47, 35, 51, 44, 40, 42, 41, 37, 49, 28, 39, 32, 22, 48, 21, 43, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 45, 26, 10, 19, 12, 25, 29, 0, 15, 27, 30, 9, 20, 4, 2, 8, 14, 7, 18, 1, 11, 6, 5, 3 , 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 44  : [56, 55, 53, 50, 54, 52, 46, 49, 47, 35, 51, 44, 40, 42, 41, 37, 45, 28, 39, 32, 22, 48, 21, 43, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 3, 26, 10, 19, 12, 25, 29, 0, 15, 27, 30, 9, 20, 4, 2, 8, 14, 7, 18, 1, 11, 6, 5 , 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 45  : [55, 54, 53, 50, 51, 52, 46, 49, 47, 35, 48, 44, 40, 42, 41, 37, 45, 28, 39, 32, 22, 30, 21, 43, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 3, 26, 10, 19, 12, 25, 29, 0, 15, 27, 5, 9, 20, 4, 2, 8, 14, 7, 18, 1, 11, 6 , 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 46  : [54, 51, 53, 50, 48, 52, 46, 49, 47, 35, 30, 44, 40, 42, 41, 37, 45, 28, 39, 32, 22, 27, 21, 43, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 3, 26, 10, 19, 12, 25, 29, 0, 15, 6, 5, 9, 20, 4, 2, 8, 14, 7, 18, 1, 11 , 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 47  : [53, 51, 52, 50, 48, 44, 46, 49, 47, 35, 30, 43, 40, 42, 41, 37, 45, 28, 39, 32, 22, 27, 21, 11, 34, 23, 13, 31, 17, 38, 33, 24, 16, 36, 3, 26, 10, 19, 12, 25, 29, 0, 15, 6, 5, 9, 20, 4, 2, 8, 14, 7, 18, 1 , 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 48  : [52, 51, 46, 50, 48, 44, 42, 49, 47, 35, 30, 43, 40, 31, 41, 37, 45, 28, 39, 32, 22, 27, 21, 11, 34, 23, 13, 1, 17, 38, 33, 24, 16, 36, 3, 26, 10, 19, 12, 25, 29, 0, 15, 6, 5, 9, 20, 4, 2, 8, 14, 7, 18 , 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 49  : [51, 50, 46, 49, 48, 44, 42, 45, 47, 35, 30, 43, 40, 31, 41, 37, 36, 28, 39, 32, 22, 27, 21, 11, 34, 23, 13, 1, 17, 38, 33, 24, 16, 18, 3, 26, 10, 19, 12, 25, 29, 0, 15, 6, 5, 9, 20, 4, 2, 8, 14, 7 , 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 50  : [50, 49, 46, 47, 48, 44, 42, 45, 39, 35, 30, 43, 40, 31, 41, 37, 36, 28, 19, 32, 22, 27, 21, 11, 34, 23, 13, 1, 17, 38, 33, 24, 16, 18, 3, 26, 10, 7, 12, 25, 29, 0, 15, 6, 5, 9, 20, 4, 2, 8, 14 , 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 51  : [49, 48, 46, 47, 35, 44, 42, 45, 39, 32, 30, 43, 40, 31, 41, 37, 36, 28, 19, 29, 22, 27, 21, 11, 34, 23, 13, 1, 17, 38, 33, 24, 16, 18, 3, 26, 10, 7, 12, 25, 14, 0, 15, 6, 5, 9, 20, 4, 2, 8 , 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 52  : [48, 47, 46, 45, 35, 44, 42, 37, 39, 32, 30, 43, 40, 31, 41, 24, 36, 28, 19, 29, 22, 27, 21, 11, 34, 23, 13, 1, 17, 38, 33, 8, 16, 18, 3, 26, 10, 7, 12, 25, 14, 0, 15, 6, 5, 9, 20, 4, 2 , 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 53  : [47, 45, 46, 39, 35, 44, 42, 37, 28, 32, 30, 43, 40, 31, 41, 24, 36, 26, 19, 29, 22, 27, 21, 11, 34, 23, 13, 1, 17, 38, 33, 8, 16, 18, 3, 2, 10, 7, 12, 25, 14, 0, 15, 6, 5, 9, 20, 4 , 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 54  : [46, 45, 44, 39, 35, 43, 42, 37, 28, 32, 30, 34, 40, 31, 41, 24, 36, 26, 19, 29, 22, 27, 21, 11, 4, 23, 13, 1, 17, 38, 33, 8, 16, 18, 3, 2, 10, 7, 12, 25, 14, 0, 15, 6, 5, 9, 20 , 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 55  : [45, 39, 44, 37, 35, 43, 42, 36, 28, 32, 30, 34, 40, 31, 41, 24, 20, 26, 19, 29, 22, 27, 21, 11, 4, 23, 13, 1, 17, 38, 33, 8, 16, 18, 3, 2, 10, 7, 12, 25, 14, 0, 15, 6, 5, 9 , 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 56  : [44, 39, 43, 37, 35, 40, 42, 36, 28, 32, 30, 34, 23, 31, 41, 24, 20, 26, 19, 29, 22, 27, 21, 11, 4, 9, 13, 1, 17, 38, 33, 8, 16, 18, 3, 2, 10, 7, 12, 25, 14, 0, 15, 6, 5 , 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 57  : [43, 39, 42, 37, 35, 40, 41, 36, 28, 32, 30, 34, 23, 31, 38, 24, 20, 26, 19, 29, 22, 27, 21, 11, 4, 9, 13, 1, 17, 5, 33, 8, 16, 18, 3, 2, 10, 7, 12, 25, 14, 0, 15, 6 , 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 58  : [42, 39, 41, 37, 35, 40, 38, 36, 28, 32, 30, 34, 23, 31, 33, 24, 20, 26, 19, 29, 22, 27, 21, 11, 4, 9, 13, 1, 17, 5, 6, 8, 16, 18, 3, 2, 10, 7, 12, 25, 14, 0, 15 , 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 59  : [41, 39, 40, 37, 35, 34, 38, 36, 28, 32, 30, 15, 23, 31, 33, 24, 20, 26, 19, 29, 22, 27, 21, 11, 4, 9, 13, 1, 17, 5, 6, 8, 16, 18, 3, 2, 10, 7, 12, 25, 14, 0 , 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 60  : [40, 39, 38, 37, 35, 34, 33, 36, 28, 32, 30, 15, 23, 31, 6, 24, 20, 26, 19, 29, 22, 27, 21, 11, 4, 9, 13, 1, 17, 5, 0, 8, 16, 18, 3, 2, 10, 7, 12, 25, 14 , 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 61  : [39, 37, 38, 36, 35, 34, 33, 24, 28, 32, 30, 15, 23, 31, 6, 16, 20, 26, 19, 29, 22, 27, 21, 11, 4, 9, 13, 1, 17, 5, 0, 8, 14, 18, 3, 2, 10, 7, 12, 25 , 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 62  : [38, 37, 34, 36, 35, 25, 33, 24, 28, 32, 30, 15, 23, 31, 6, 16, 20, 26, 19, 29, 22, 27, 21, 11, 4, 9, 13, 1, 17, 5, 0, 8, 14, 18, 3, 2, 10, 7, 12 , 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 63  : [37, 36, 34, 28, 35, 25, 33, 24, 26, 32, 30, 15, 23, 31, 6, 16, 20, 12, 19, 29, 22, 27, 21, 11, 4, 9, 13, 1, 17, 5, 0, 8, 14, 18, 3, 2, 10, 7 , 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 64  : [36, 35, 34, 28, 32, 25, 33, 24, 26, 29, 30, 15, 23, 31, 6, 16, 20, 12, 19, 7, 22, 27, 21, 11, 4, 9, 13, 1, 17, 5, 0, 8, 14, 18, 3, 2, 10 , 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 65  : [35, 32, 34, 28, 30, 25, 33, 24, 26, 29, 27, 15, 23, 31, 6, 16, 20, 12, 19, 7, 22, 10, 21, 11, 4, 9, 13, 1, 17, 5, 0, 8, 14, 18, 3, 2 , 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 66  : [34, 32, 33, 28, 30, 25, 31, 24, 26, 29, 27, 15, 23, 17, 6, 16, 20, 12, 19, 7, 22, 10, 21, 11, 4, 9, 13, 1, 2, 5, 0, 8, 14, 18, 3 , 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 67  : [33, 32, 31, 28, 30, 25, 17, 24, 26, 29, 27, 15, 23, 3, 6, 16, 20, 12, 19, 7, 22, 10, 21, 11, 4, 9, 13, 1, 2, 5, 0, 8, 14, 18 , 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 68  : [32, 30, 31, 28, 29, 25, 17, 24, 26, 22, 27, 15, 23, 3, 6, 16, 20, 12, 19, 7, 18, 10, 21, 11, 4, 9, 13, 1, 2, 5, 0, 8, 14 , 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 69  : [31, 30, 25, 28, 29, 23, 17, 24, 26, 22, 27, 15, 14, 3, 6, 16, 20, 12, 19, 7, 18, 10, 21, 11, 4, 9, 13, 1, 2, 5, 0, 8 , 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 70  : [30, 29, 25, 28, 27, 23, 17, 24, 26, 22, 21, 15, 14, 3, 6, 16, 20, 12, 19, 7, 18, 10, 8, 11, 4, 9, 13, 1, 2, 5, 0 , 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 71  : [29, 28, 25, 26, 27, 23, 17, 24, 19, 22, 21, 15, 14, 3, 6, 16, 20, 12, 0, 7, 18, 10, 8, 11, 4, 9, 13, 1, 2, 5 , 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 72  : [28, 27, 25, 26, 22, 23, 17, 24, 19, 18, 21, 15, 14, 3, 6, 16, 20, 12, 0, 7, 5, 10, 8, 11, 4, 9, 13, 1, 2 , 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 73  : [27, 26, 25, 24, 22, 23, 17, 20, 19, 18, 21, 15, 14, 3, 6, 16, 2, 12, 0, 7, 5, 10, 8, 11, 4, 9, 13, 1 , 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 74  : [26, 24, 25, 20, 22, 23, 17, 16, 19, 18, 21, 15, 14, 3, 6, 1, 2, 12, 0, 7, 5, 10, 8, 11, 4, 9, 13 , 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 75  : [25, 24, 23, 20, 22, 15, 17, 16, 19, 18, 21, 13, 14, 3, 6, 1, 2, 12, 0, 7, 5, 10, 8, 11, 4, 9 , 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 76  : [24, 22, 23, 20, 21, 15, 17, 16, 19, 18, 10, 13, 14, 3, 6, 1, 2, 12, 0, 7, 5, 9, 8, 11, 4 , 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 77  : [23, 22, 17, 20, 21, 15, 6, 16, 19, 18, 10, 13, 14, 3, 4, 1, 2, 12, 0, 7, 5, 9, 8, 11 , 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 78  : [22, 21, 17, 20, 18, 15, 6, 16, 19, 11, 10, 13, 14, 3, 4, 1, 2, 12, 0, 7, 5, 9, 8 , 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 79  : [21, 20, 17, 19, 18, 15, 6, 16, 12, 11, 10, 13, 14, 3, 4, 1, 2, 8, 0, 7, 5, 9 , 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 80  : [20, 19, 17, 16, 18, 15, 6, 9, 12, 11, 10, 13, 14, 3, 4, 1, 2, 8, 0, 7, 5 , 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 81  : [19, 18, 17, 16, 11, 15, 6, 9, 12, 7, 10, 13, 14, 3, 4, 1, 2, 8, 0, 5 , 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 82  : [18, 16, 17, 12, 11, 15, 6, 9, 8, 7, 10, 13, 14, 3, 4, 1, 2, 5, 0 , 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 83  : [17, 16, 15, 12, 11, 14, 6, 9, 8, 7, 10, 13, 0, 3, 4, 1, 2, 5 , 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 84  : [16, 12, 15, 9, 11, 14, 6, 5, 8, 7, 10, 13, 0, 3, 4, 1, 2 , 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 85  : [15, 12, 14, 9, 11, 13, 6, 5, 8, 7, 10, 2, 0, 3, 4, 1 , 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 86  : [14, 12, 13, 9, 11, 2, 6, 5, 8, 7, 10, 1, 0, 3, 4 , 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 87  : [13, 12, 6, 9, 11, 2, 4, 5, 8, 7, 10, 1, 0, 3 , 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 88  : [12, 11, 6, 9, 10, 2, 4, 5, 8, 7, 3, 1, 0 , 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 89  : [11, 10, 6, 9, 7, 2, 4, 5, 8, 0, 3, 1 , 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 90  : [10, 9, 6, 8, 7, 2, 4, 5, 1, 0, 3 , 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 91  : [9, 8, 6, 5, 7, 2, 4, 3, 1, 0 , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 92  : [8, 7, 6, 5, 0, 2, 4, 3, 1 , 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 93  : [7, 5, 6, 3, 0, 2, 4, 1 , 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 94  : [6, 5, 4, 3, 0, 2, 1 , 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 95  : [5, 3, 4, 1, 0, 2 , 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 96  : [4, 3, 2, 1, 0 , 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 97  : [3, 1, 2, 0 , 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 98  : [2, 1, 0 , 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 99  : [1, 0 , 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Heap step 100 : [0 , 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]


Heap Sorted List   : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]





Thank you, Github for this heap sort implementation using python.


Post a Comment

Previous Post Next Post