Exemplo n.º 1
0
 def test_case_9(self):
     tree = BinaryTree(0)
     tree.left = BinaryTree(9)
     tree.right = BinaryTree(1)
     tree.right.left = BinaryTree(15)
     tree.right.right = BinaryTree(10)
     tree.right.right.left = BinaryTree(100)
     tree.right.right.right = BinaryTree(200)
     self.assertEqual(program.branchSums(tree), [9, 16, 111, 211])
Exemplo n.º 2
0
 def test_case_1(self):
     tree = BinaryTree(1).insert([2, 3, 4, 5, 6, 7, 8, 9, 10])
     self.assertEqual(program.branchSums(tree), [15, 16, 18, 10, 11])
Exemplo n.º 3
0
 def test_case_1(self):
     tree = BinaryTree(1)
     self.assertEqual(program.branchSums(tree), [1])
Exemplo n.º 4
0
 def test_case_8(self):
     tree = BinaryTree(0)
     tree.right = BinaryTree(1)
     tree.right.right = BinaryTree(10)
     tree.right.right.right = BinaryTree(100)
     self.assertEqual(program.branchSums(tree), [111])
Exemplo n.º 5
0
 def test_case_4(self):
     tree = BinaryTree(1).insert([2, 3, 4, 5])
     self.assertEqual(program.branchSums(tree), [7, 8, 4])
Exemplo n.º 6
0
 def test_case_2(self):
     tree = BinaryTree(1).insert([2])
     self.assertEqual(program.branchSums(tree), [3])