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
def setUp(self): self.builder = Str2Tree() self.func = Tree2Str()
def setUp(self): self.builder = Str2Tree() self.serializer = Tree2Str() self.func = DeepestSmallestSubtree().subtreeWithAllDeepest
def setUp(self): self.builder = Str2Tree() self.serializer = Tree2Str() self.func = BinaryTreeToList()
def setUp(self): self.builder = Str2Tree().str2tree self.serializer = Tree2Str().tree2str self.func = DeleteNodes().delNodes