Question 34 In the code for the add method in the implementation of a heap, what is the missing code? def add(self, item
Posted: Thu May 05, 2022 2:01 pm
Question 34 In the code for the add method in the implementation of a heap, what is the missing code? def add(self, item): self.size +1 self.heap.append(item) curPoslen (self.heap) - 1 while curPos > 0: parent (curPos - 1) 7/2 parentItem-self-heap [parent] if parentItem <- item: missing code> else: self.heap [curPos] - self.heap[parent] self.heap [parent] sten curPos-parent curPos += 1 Obreak O self heap[curPos] = item parent curpos 1 pts