/// <summary> /// Insert value under current node. /// </summary> /// <param name="data">Stored value.</param> internal void InsertUnderNode(T data, IComparer <T> comparer) { if (BinaryTree <T> .CompareValues(data, Value, comparer) < 0) { if (LeftNode == null) { LeftNode = new TreeNode <T>(data, this); return; } else { LeftNode.InsertUnderNode(data, comparer); } } else { if (RightNode == null) { RightNode = new TreeNode <T>(data, this); return; } else { RightNode.InsertUnderNode(data, comparer); } } }