Exemplo n.º 1
0
 public static void AddZeroToPartial(BinTreeNode <int> r)
 {
     if (r == null)
     {
         return;
     }
     if (r.GetLeft() != null && r.GetRight() == null)
     {
         r.SetRight(new BinTreeNode <int>(0));
         AddZeroToPartial(r.GetLeft());
     }
     else if (r.GetLeft() == null && r.GetRight() != null)
     {
         r.SetLeft(new BinTreeNode <int>(0));
         AddZeroToPartial(r.GetRight());
     }
     else
     {
         AddZeroToPartial(r.GetLeft());
         AddZeroToPartial(r.GetRight());
     }
 }