public static IEnumerable <T> Traverse <T>(this T root, TraverseType traverseType)
            where T : ITreeNode <T>
        {
            switch (traverseType)
            {
            case TraverseType.PreOrder:
                return(root.PreOrderTraverse());

            case TraverseType.Ancestors:
                return(root.AncestorsTraverse());

            default:
                throw new NotSupportedException(traverseType.ToString());
            }
        }
Пример #2
0
 public override string ToString() => "BinaryTree: " + tree.ToString() + "\nTraverseTyp: " + traverseType.ToString();