appending is that it guarantees that we will maintain the complete tree property the bad news about appending is that we will very likely violate the heap structure property howeverit is possible to write method that will allow us to regain the heap structure property by comparing the newly added item with its parent if the newly added item is less than its parentthen we can swap the item with its parent figure shows the series of swaps needed to percolate the newly added item up to its proper position in the tree figure percolate the new node up to its proper position notice that when we percolate an item upwe are restoring the heap property between the newly added item and the parent we are also preserving the heap property for any siblings of courseif the newly added item is very smallwe may still need to swap it up another level in factwe may need to keep swapping until we get to the top of the tree below we show the perc_up methodwhich percolates new item as far up in the tree as it needs to go to maintain the heap property here is where our wasted element in heap_list is important priority queues with binary heaps