public void InitialTreeHasDepthZero() { var myTree = new DemoTree <int>(); myTree.Add(1); Assert.AreEqual(0, myTree.Depth()); }
public void Add(T value) { if (LeftChild == null) { LeftChild = new DemoTree <T>(value); return; } if (RightChild == null) { RightChild = new DemoTree <T>(value); return; } if (LeftChild.Depth() <= RightChild.Depth()) { LeftChild.Add(value); return; } RightChild.Add(value); }