def test_case11(self): #===> nums = "98,97,#,88,#,84,#,79,87,64,#,#,#,63,69,62,#,#,#,30,#,27,59,9,#,#,#,3,#,0,#,-4,#,-16,#,-18,-7,-19,#,#,#,-23,#,-34,#,-42,#,-59,#,-63,#,-64,#,-69,#,-75,#,-81" answer = "98,#,97,#,88,#,84,#,79,#,64,#,63,#,62,#,30,#,27,#,9,#,3,#,0,#,-4,#,-16,#,-18,#,-19,#,-23,#,-34,#,-42,#,-59,#,-63,#,-64,#,-69,#,-75,#,-81,#,-7,#,59,#,69,#,87" from util.tree_node import TreeNode root = TreeNode.generate_bt_from_string_standard(nums) answer_tree = TreeNode.generate_bt_from_string_standard(answer) self.sol.flatten(root) compare = TreeNode.compare_tree(root, answer_tree) self.assertTrue(compare)
def test_case11(self): #===> nums = "98,97,#,88,#,84,#,79,87,64,#,#,#,63,69,62,#,#,#,30,#,27,59,9,#,#,#,3,#,0,#,-4,#,-16,#,-18,-7,-19,#,#,#,-23,#,-34,#,-42,#,-59,#,-63,#,-64,#,-69,#,-75,#,-81" answer = "98,#,97,#,88,#,84,#,79,#,64,#,63,#,62,#,30,#,27,#,9,#,3,#,0,#,-4,#,-16,#,-18,#,-19,#,-23,#,-34,#,-42,#,-59,#,-63,#,-64,#,-69,#,-75,#,-81,#,-7,#,59,#,69,#,87" from util.tree_node import TreeNode root = TreeNode.generate_bt_from_string_standard(nums) answer_tree = TreeNode.generate_bt_from_string_standard(answer) self.sol.flatten(root) compare = TreeNode.compare_tree(root, answer_tree) self.assertTrue(compare)
def test_case1(self): A = [6,4,20] answer = "20,6,#,#,4" # wrong output "6,#,20,4" result = self.sol.maxTree(A) answer_tree = TreeNode.generate_bt_from_string_standard(answer) self.assertTrue(TreeNode.compare_tree(answer_tree, result))
def test_case1(self): A = [6, 4, 20] answer = "20,6,#,#,4" # wrong output "6,#,20,4" result = self.sol.maxTree(A) answer_tree = TreeNode.generate_bt_from_string_standard(answer) self.assertTrue(TreeNode.compare_tree(answer_tree, result))