public void AddNode(int newData) { if (newData >= data) { if (rightBranch == null) { rightBranch = new Node(newData); } else { rightBranch.AddNode(newData); } } else { if (leftBranch == null) { leftBranch = new Node(newData); } else { leftBranch.AddNode(newData); } } }
public void AddData(int data) { if (root == null) { root = new Node(data); } else { root.AddNode(data); } }