Пример #1
0
 public static int SumLeafs(BinNode<int> t)
 {
     if (t == null)
         return 0;
     if (IsLeaf(t))
         return t.GetInfo();
     return SumLeafs(t.GetLeft()) + SumLeafs(t.GetRight());
 }
Пример #2
0
 //Q7a
 public static bool IsStatic(BinNode<int> tree)
 {
     if (tree == null || IsLeaf(tree))
         return true;
     return tree.GetInfo() == SumLeafs(tree.GetLeft()) + SumLeafs(tree.GetRight());
 }