figure complete binary tree along with its list representation traverse complete binary tree using only few simple mathematical operations we will see that this also leads to an efficient implementation of our binary heap the heap order property the method that we will use to store items in heap relies on maintaining the heap order property the heap order property is as followsin heapfor every node with parent pthe key in is smaller than or equal to the key in figure also illustrates complete binary tree that has the heap order property heap operations we will begin our implementation of binary heap with the constructor since the entire binary heap can be represented by single listall the constructor will do is initialize the list and an attribute current_size to keep track of the current size of the heap below we show the python code for the constructor you will notice that an empty binary heap has single zero as the first element of heap_list and that this zero is not usedbut is there so that simple integer division can be used in later methods class binheapdef __init__(self)self heap_list [ self current_size the next method we will implement is insert the easiestand most efficientway to add an item to list is to simply append the item to the end of the list the good news about trees and tree algorithms