public string ToStringLevel(int level, MAryTreeNode <T> root) { string result = ""; if (root == null) { return(result); } if (level <= 1) { return($"({root.Value} | {(root.Parent == null ? "/" : root.Parent.Value.ToString())})"); } else { for (int i = 0; i < root.Length; i++) { result += ToStringLevel(level - 1, root.Node(i)); } } return(result); }
public void AddChildNode(T value) { MAryTreeNode <T> node = new MAryTreeNode <T>(value, this); children.InsertItem(node); }
public MAryTreeNode(T value, MAryTreeNode <T> parent) : base(value, parent) { children = new List <MAryTreeNode <T> >(); }
public int GetHeight(MAryTreeNode <T> root) { throw new NotImplementedException(); }
public MAryTree(T value) { root = new MAryTreeNode <T>(value); }