I mean, why not use the append() function of the python list when adding a new element, and do the sorting work. Then when you delete,
removeElement = self.minheap[1]
self.minheap[1] = self.minheap.pop()Is the heapSize additional to realsize neccessary? This extra boundary makes me a little uncomfortable. Can anyone explain if the heapSize is really necessary? And what makes it neccessary? Thanks!