Exemplo n.º 1
0
 def test_treemap2(self):
     t = TreeMap()
     t.put(4, 'four')
     t.put(2, 'two')
     t.put(3, 'three')
     t.put(1, 'one')
     t.put(7, 'seven')
     t.put(5, 'five')
     t.put(6, 'six')
     self.assertEqual(t.tree_height(), 3)
Exemplo n.º 2
0
 def test_treemap9(self):
     t = TreeMap()
     t.put(4, 'four')
     t.put(2, 'two')
     t.put(3, 'three')
     t.put(1, 'one')
     t.put(7, 'seven')
     t.put(5, 'five')
     t.put(6, 'six')
     t.delete(6)
     self.assertEqual(t.tree_height(), 2)
     self.assertEqual(t.find_max(), (7,'seven'))
     self.assertEqual(t.find_min(), (1,'one'))
     t.delete(7)
     self.assertEqual(t.tree_height(), 2)
     self.assertEqual(t.find_max(), (5,'five'))
     t.delete(4)
     self.assertEqual(t.tree_height(), 2)
     self.assertEqual(t.find_max(), (5,'five'))
     self.assertEqual(t.tree.key, 5)