예제 #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])
예제 #2
0
파일: branchSums.py 프로젝트: 2qov3b/DsAlgo
 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])
예제 #3
0
 def test_case_1(self):
     tree = BinaryTree(1)
     self.assertEqual(program.branchSums(tree), [1])
예제 #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])
예제 #5
0
 def test_case_4(self):
     tree = BinaryTree(1).insert([2, 3, 4, 5])
     self.assertEqual(program.branchSums(tree), [7, 8, 4])
예제 #6
0
 def test_case_2(self):
     tree = BinaryTree(1).insert([2])
     self.assertEqual(program.branchSums(tree), [3])