public static void Main() { Tree t = new Tree(); t.Add(10); t.Add(8); t.Add(14); t.Add(12); t.Add(113); t.Add(11); t.Add(7); t.Add(9); Tree.Print(t); Console.WriteLine(t.Find(12)); Console.WriteLine(t.TwoNodes()); }
public int TwoNodes() { int n = 0; if (right != null && left != null) { n++; } if (right != null) { n += right.TwoNodes(); } if (left != null) { n += left.TwoNodes(); } return(n); }