Exemplo n.º 1
0
 def test_add_element_to_maxheap(self):
     max_heap = MaxHeap(self.array)
     max_heap.add_element(13)
     self.assertEqual(6, max_heap.length())
     self.assertEqual([13, 8, 11, 4, 3, 6], max_heap.elements())
     self.assertEqual(13, max_heap.get_root_value())
     self.assertEqual([13, 8, 11, 4, 3, 6], max_heap.elements())
Exemplo n.º 2
0
 def test_add_array_of_elements_to_maxheap(self):
     max_heap = MaxHeap(self.array)
     max_heap.add_element([1, 14, 7, 5])
     self.assertEqual(9, max_heap.length())
     self.assertEqual([14, 8, 11, 7, 3, 1, 6, 4, 5], max_heap.elements())
     self.assertEqual(14, max_heap.get_root_value())