Question: (def get_parent if 1% 2 == 1 | = 1/72 #odd equation else j = 1/2 - 1 retum def get children Jeft_child = 1*2

(def get_parent if 1% 2 == 1 | = 1/72 #odd equation else j = 1/2 - 1 retum def get children Jeft_child = 1*2 +1 right child = 1*2 + 2 return left child, right child de insert heap(heap, new number theap.append(new_number Jast_index = len(heap)-1 (heap = heapify(heap last_index return heap (def heapify(heap, index lifindex = parent value heap index), heapparent index] = parent value, my value else: #finish return heap heap = heapify(heap.parent index return heap heap[index], heapparent_index] = parent_value, my_value else: #finish return heap heap = heapify(heap,parent_index return heap :Assuming we have the following list of numbers flist_of_numbers = [48, 24, 37, 25, 38, 16, 50
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
