Ejemplo n.º 1
0
 def test_add_array_of_elements_to_minheap(self):
     min_heap = MinHeap(self.array)
     min_heap.add_element([1, 14, 7, 5])
     self.assertEqual(9, min_heap.length())
     self.assertEqual([1, 4, 3, 5, 11, 6, 14, 8, 7], min_heap.elements())
     self.assertEqual(1, min_heap.get_root_value())
Ejemplo n.º 2
0
 def test_add_element_to_minheap(self):
     min_heap = MinHeap(self.array)
     min_heap.add_element(1)
     self.assertEqual(6, min_heap.length())
     self.assertEqual([1, 4, 3, 8, 11, 6], min_heap.elements())
     self.assertEqual(1, min_heap.get_root_value())