Example #1
0
 def __init__(self, capacity=None):
     """
     :param capacity: 栈的容积
     """
     if capacity is None:
         self.array = Array()
     else:
         self.array = Array(capacity)
Example #2
0
 def __init__(self, capacity=None, arr=None):
     if arr is not None:
         # 构建一个大根堆,通过heapify操作
         self._heapify(arr)
         return
     if capacity is None:
         self._data = Array()
     else:
         self._data = Array(capacity)
Example #3
0
 def __init__(self, capacity=None):
     if capacity is None:
         self.array = Array()
     else:
         self.array = Array(capacity)