HEAP.py
def MAX_HEAP_DELETE(self, i):
        '''
        restricted delete operation 09:23
        '''
        if self.isEmpty():
            print('heap is going to be underflow.exit.')
            return
        l = self.left(i)        
        r = self.right(i)
        self.A[i] = -99999
        if l < self.heap_size and self.A[l] > self.A[i]:
            largest = l
        else:
            largest = i
        if r < self.heap_size and self.A[r] > self.A[largest]:
            largest = r
        while largest != i:
            self.A[i], self.A[largest] = self.A[largest], self.A[i]
            i = largest
            l = self.left(i)        
            r = self.right(i)
            if l < self.heap_size and self.A[l] > self.A[i]:
                largest = l
            else:
                largest = i
            if r < self.heap_size and self.A[r] > self.A[largest]:
                largest = r            
        self.heap_size -= 1

        restricted delete operation 09:23
        
restricted delete operation 09:23
restricted delete operation 09 : 23
def MAX_HEAP_DELETE(self, i):
        if self.isEmpty():
            print('heap is going to be underflow.exit.')
            return
        l = self.left(i)        
        r = self.right(i)
        self.A[i] = -99999
        if l < self.heap_size and self.A[l] > self.A[i]:
            largest = l
        else:
            largest = i
        if r < self.heap_size and self.A[r] > self.A[largest]:
            largest = r
        while largest != i:
            self.A[i], self.A[largest] = self.A[largest], self.A[i]
            i = largest
            l = self.left(i)        
            r = self.right(i)
            if l < self.heap_size and self.A[l] > self.A[i]:
                largest = l
            else:
                largest = i
            if r < self.heap_size and self.A[r] > self.A[largest]:
                largest = r            
        self.heap_size -= 1
def MAX_HEAP_DELETE ( self , i ) : if self . isEmpty ( ) : print ( 'heap is going to be underflow.exit.' ) return l = self . left ( i ) r = self . right ( i ) self . A [ i ] = - 99999 if l < self . heap_size and self . A [ l ] > self . A [ i ] : largest = l else : largest = i if r < self . heap_size and self . A [ r ] > self . A [ largest ] : largest = r while largest != i : self . A [ i ] , self . A [ largest ] = self . A [ largest ] , self . A [ i ] i = largest l = self . left ( i ) r = self . right ( i ) if l < self . heap_size and self . A [ l ] > self . A [ i ] : largest = l else : largest = i if r < self . heap_size and self . A [ r ] > self . A [ largest ] : largest = r self . heap_size -= 1
restricted delete operation 09:23
restricted delete operation 09 : 23
'''
        restricted delete operation 09:23
        '''
self
i