Question: def remove _ min ( self ) - > object:from dynamic _ array import * class MinHeapException ( Exception ) : Custom

def remove_min(self)-> object:from dynamic_array import *
class MinHeapException(Exception):
"""
Custom exception to be used by MinHeap class
DO NOT CHANGE THIS CLASS IN ANY WAY
"""
pass
class MinHeap:
def __init__(self, start_heap=None):
"""
Initialize a new MinHeap
DO NOT CHANGE THIS METHOD IN ANY WAY
"""
self._heap = DynamicArray()
# populate MinHeap with initial values (if provided)
# before using this feature, implement add() method
if start_heap:
for node in start_heap:
self.add(node)
def __str__(self)-> str:
"""
Return MinHeap content in human-readable form
DO NOT CHANGE THIS METHOD IN ANY WAY
"""
heap_data =[self._heap[i] for i in range(self._heap.length())]
return "HEAP "+ str(heap_data)
def add(self, node: object)-> None:
"""
TODO: Write this implementation
"""
pass
def is_empty(self)-> bool:
"""
TODO: Write this implementation
"""
pass
def get_min(self)-> object:
"""
TODO: Write this implementation
"""
pass
def remove_min(self)-> object:
"""
TODO: Write this implementation
"""
pass
def build_heap(self, da: DynamicArray)-> None:
"""
TODO: Write this implementation
"""
pass
def size(self)-> int:
"""
TODO: Write this implementation
"""
pass
def clear(self)-> None:
"""
TODO: Write this implementation
"""
pass
def heapsort(da: DynamicArray)-> None:
"""
TODO: Write this implementation
"""
pass
# It's highly recommended that you implement the following optional #
# helper function for percolating elements down the MinHeap. You can call #
# this from inside the MinHeap class. You may edit the function definition. #
def _percolate_down(da: DynamicArray, parent: int)-> None:
"""
TODO: Write your implementation
"""
pass
"""
TODO: Write this implementation
"""
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!