of children and parents the children of any element of the array can be calculated from the index of the parent leftchildindex parentindex rightchildindex parentindex using these formulae on fig we can see that the children of the root node ( index are (at index and (at index likewisethe children of are located at index and which are the values and which we can verify are the same children as in the conceptual model of coursenot every node has child or even two children if the computed leftchildindex or rightchildindex are greater than or equal to the number of values in the heapthen the node in question is leaf node it is also possible to go in the other direction given child' indexwe can discover where the parent is located parentindex (childindex )// the /in the previous formula represents integer division it means that the result is always an integer if there were fractional part we round down to the next lower integer sothe index of the parent of the in fig is computed as parentindex ( )// consulting the conceptual model in fig we see that the value at index in the arraythe is indeed the parent of the it should be noted that not every node in heap has parent in particularthe root nodeat index does not have parent all other nodes in heap have parents building heap now that we've seen what heap looks likewe'll investigate building heap heaps can be built either largest on top or smallest on top we'll build largest on top heap heap class will encapsulate the data and methods needed to build heap heap objects contain list and count of the number of items currently stored in the heap we'll call this count the size of the heap to encapsulate the data we'll want method that will take sequence of values and build heap from it we'll call this method buildfrom private method will also be useful the buildfrom method will call the _siftupfrom to get each successive element of the sequence into its correct position within the heap the buildfrom method def buildfrom(selfasequence)'''asequence is an instance of sequence collection which understands the comparison operators the elements of asequence are copied into the heap and ordered to build heap ''this copy belongs to 'acha