testing the heap now we just need some code to test the heap we begin by creating our heap and inserting some datah heap(for in ( ) insert(iwe can print the heap listjust to inspect how the elements are ordered if you redraw this as tree structureyou should notice that it meets the required properties of heapprint( heapnow we will pop off the itemsone at time notice how the items come out in sorted orderfrom lowest to highest also notice how the heap list changes after each pop it is good idea to take out pen and paper and to redraw this list as tree after each popto fully understand how the sink(method worksfor in range( ) pop(print(nprint( heapin the on sorting algorithmswe will reorganize the code for the heap sort algorithm once you have the min heap working properly and understand how it worksit should be simple task to implement max heap all you have to do is to reverse the logic selection algorithms selection algorithms fall under class of algorithms that seek to answer the problem of finding the ith-smallest element in list when list is sorted in ascending orderthe first element in the list will be the smallest item in the list the second element in the list will be the second-smallest element in the list the last element in the list will be the last-smallest element in the list but that will also qualify as the largest element in the list