Exemplo n.º 1
0
 def test_leftRotationOnRoot(self):
     tree = AVLTree()
     tree.insert(1)
     tree.insert(2)
     tree.insert(3)
     tree.root = tree.left_rotation(tree.root)
     nodes = tree.preorder_traversal()
     self.assertEqual(nodes, [2, 1, 3])
Exemplo n.º 2
0
 def test_leftRotationNoRoot(self):
     tree = AVLTree()
     tree.left_rotation(tree.root)
     nodes = tree.preorder_traversal()
     self.assertEqual(nodes, [])