def test_2(self):
     preorder = [4, 2]
     s = '4(2)'
     expected = self.builder.str2tree(s)
     result = self.func(preorder)
     self.assertEqual(Tree2Str().tree2str(result),
                      Tree2Str().tree2str(expected))
 def test_1(self):
     preorder = [8, 5, 1, 7, 10, 12]
     s = '8(5(1)(7))(10()(12))'
     expected = self.builder.str2tree(s)
     result = self.func(preorder)
     self.assertEqual(Tree2Str().tree2str(result),
                      Tree2Str().tree2str(expected))
 def setUp(self):
     self.helper = Tree2Str()
     self.func = PreorderInorder()
 def setUp(self):
     self.builder = Str2Tree().str2tree
     self.serializer = Tree2Str().tree2str
     self.func = FlippedBinaryTree().flipEquiv
Ejemplo n.º 5
0
 def setUp(self):
     self.builder = Str2Tree()
     self.func = Tree2Str()
Ejemplo n.º 6
0
 def setUp(self):
     self.builder = Str2Tree()
     self.serializer = Tree2Str()
     self.func = DeepestSmallestSubtree().subtreeWithAllDeepest
Ejemplo n.º 7
0
 def setUp(self):
     self.builder = Str2Tree()
     self.serializer = Tree2Str()
     self.func = BinaryTreeToList()
Ejemplo n.º 8
0
 def setUp(self):
     self.builder = Str2Tree().str2tree
     self.serializer = Tree2Str().tree2str
     self.func = DeleteNodes().delNodes