Exemple #1
0
	def __init__(self, comparatorfn=None):
		Heap.__init__(self)

		# flip comparator function to flip > and <
		# so a minheap becomes a maxheap
		_comparatorfn = comparatorfn if comparatorfn else cmp
		self.comparatorfn = lambda a, b: _comparatorfn(b, a)
		self.isMaxHeap = self.isHeap_r
Exemple #2
0
 def __init__(self, *args, **kwargs):
     Heap.__init__(self, *args, **kwargs)
 def __init__(self, A):
     # build heap
     Heap.__init__(self, A)
Exemple #4
0
 def __init__(self):
     Heap.__init__(self)
    def __init__(self, is_max_heap=True):

        Heap.__init__(self)

        self.is_max_heap = is_max_heap
Exemple #6
0
	def __init__(self, comparatorfn=cmp):
		Heap.__init__(self, comparatorfn)
		self.lookup = {}
 def __init__(self, array):
     Heap.__init__(self, array)
Exemple #8
0
 def __init__(self):
     Heap.__init__(self)
Exemple #9
0
 def __init__(self, array):
     Heap.__init__(self, array)