Question: def special _ tree ( values, k ) : ####### DO NOT MODIFY THE CODE BELOW ####### myTree = MySpecialTree ( values ) soln =

def special_tree( values, k ) :
####### DO NOT MODIFY THE CODE BELOW #######
myTree = MySpecialTree(values)
soln =[]
for val in range(k):
soln.append(myTree.pop_max_value())
return soln
####### DO NOT MODIFY THE CODE ABOVE #######
class MySpecialTree():
def __init__(self, values=None):
self.data = values or []
for x in range(len(values)//2,-1,-1):
self.__max_treeify__(x)
def parent(self, x):
return x >>1
def left_child(self, x):
return (x <<1)+1
def right_child(self, x):
return (x <<1)+2
def __max_treeify__(self, x):
pass
def pop_max_value(self):
pass

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 Programming Questions!