Exemple #1
0
 def test_pop_right_min_removes_min(self):
     a = AVLTree()
     a[5] = 'a'
     a[1] = 'a'
     a[9] = 'a'
     a[8] = 'a'
     self.assertIsNotNone(a.root.right.left)
     a._pop_right_min(a.root)
     self.assertIsNone(a.root.right.left)
Exemple #2
0
 def test_pop_right_min_removes_min_and_keeps_children(self):
     a = AVLTree()
     a[5] = 'a'
     a[1] = 'a'
     a[8] = 'a'
     a[9] = 'a'
     self.assertEqual(a.root.right.key, 8)
     a._pop_right_min(a.root)
     self.assertEqual(a.root.right.key, 9)
Exemple #3
0
 def test_pop_right_min_returns_min(self):
     a = AVLTree()
     a[5] = 'a'
     a[1] = 'a'
     a[9] = 'a'
     a[8] = 'a'
     self.assertEqual(a._pop_right_min(a.root).key, 8)