Example #1
0
 def test_maxheapify_OnRootExchanges(self):
     arr = [0, 12, 15, 4]
     dac.max_heapify(arr, 1)
     expected = [0, 15, 12, 4]
     self.assertEqual(expected, arr)
Example #2
0
 def test_maxheapify_OnBigArray(self):
     arr = [0, 4, 14, 10, 8, 7, 9, 3, 2, 4, 1]
     dac.max_heapify(arr, 1)
     expected = [0, 14, 8, 10, 4, 7, 9, 3, 2, 4, 1]
     self.assertEqual(expected, arr)
Example #3
0
 def test_maxheapify_OnLeafDoesntExchange(self):
     arr = [0, 15, 4, 3]
     dac.max_heapify(arr, 3)
     expected = [0, 15, 4, 3]
     self.assertEqual(expected, arr)