Esempio n. 1
0
    def __init__(self, data=None):
        """
        Build a binomial heap from the provided dataset
        """
        if data is None:
            data = []

        self.trees = LinkedList()
        self.trees.append(None)

        # Pointer to the minimal tree
        self.min_tree = None

        for i in data:
            self.insert(i)
Esempio n. 2
0
 def __init__(self, data=None):
     # Use composition to hide the linked list implementation details
     self._linked_list = LinkedList(
     ) if not data else LinkedList.from_array(data)
     self._lock = Lock()
Esempio n. 3
0
 def __init__(self):
     # Use composition to hide the linked list implementation details
     self._linked_list = LinkedList()
     self._lock = Lock()