def test_decrease_key(self): nodes = [] maxNode = None H = FibHeap() random.seed() for d in range(10000): n = FibNode(random.randint(1, 100000)) if maxNode == None or n.get_key() > maxNode.get_key(): maxNode = n nodes.append(n) H.insert_node(n) H.decrease_key(maxNode, H.get_min().get_key()) self.assertEqual(maxNode.get_key(), H.get_min().get_key())
def test_insert_data(self): nodes = [] minNode = None H = FibHeap() random.seed() for d in range(10000): n = FibNode(random.randint(1, 100000)) if minNode == None or n.get_key() < minNode.get_key(): minNode = n nodes.append(n) H.insert_node(n) self.assertEqual(H.get_min(), minNode)
def test_insert_data(self): nodes = [] minNode=None H = FibHeap() random.seed() for d in range(10000): n = FibNode(random.randint(1, 100000)) if minNode == None or n.get_key() < minNode.get_key(): minNode = n nodes.append(n) H.insert_node(n) self.assertEqual(H.get_min(), minNode)