Question: python I need to complete the code to get the output Three way heap Due February 18, 2021 11:59 PM Instructions The following are the

python  python I need to complete the code to get the output
Three way heap Due February 18, 2021 11:59 PM Instructions The following
I need to complete the code to get the output
are the functions for max heap using a Binary tree. def get

Three way heap Due February 18, 2021 11:59 PM Instructions The following are the functions for max heap using a Binary tree. def get parent: if i % 2 = = 1: J = 1/2 #odd equation else: j = 1/2 - 1 return def get children left child = i 2 + night.child = i 2-2 return left child, right child def insert heap(heap, new number: heap.append(new number last index = len(heap-1 heap = heapifycheaplast index return heap def heapify heap, index: if index=0 return heap my value heap index parent index - ger parentindex PARL. We are indexl Primy vale parent Malue Baren anden if my value Parent these indexentinderen y value else with heap.append(new number) last_index = len(heap)-| heap = heapify heap. last index) return heap def heapify heap, index: if index = parent value: heaplindexl, heapparent indexl = parent value, my value else: #finish return heap heap = heapify(heap,parent.index) return heap Assuming we have the following list of numbers: > > > list of numbers = [48, 24, 37, 25, 38, 16.50 The heap would be created as follows: heap=0 for new number in list of numbers heap = insert heap cheap, new.number The output would be > > > heap [50, 38 48 24 29 16.37 Assuming we have the follo >>> list of numbers = [48 The heap would be created heap=0 for new number in list of heap = insert_heap(hea The output would be : > > > heap [50, 38, 48, 24, 25, 16, 37]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!