public IEnumerable <Node <T> > TraverseTree(TreeTravesralMode mode) { switch (mode) { case TreeTravesralMode.PreOrder: return(PreOrderTraversal(root)); case TreeTravesralMode.PostOrder: return(PostOrderTraversal(root)); case TreeTravesralMode.InOrder: return(InOrderTraversal(root)); case TreeTravesralMode.LevelOrder: //return LevelOrderTraversal(root); default: throw new InvalidOperationException("Invalid Mode for Tree Traversal"); } }
public void TraverseTree(TreeTravesralMode mode) { switch (mode) { case TreeTravesralMode.PreOrder: PreOrderTraversal(root); break; case TreeTravesralMode.PostOrder: PostOrderTraversal(root); break; case TreeTravesralMode.InOrder: InOrderTraversal(root); break; case TreeTravesralMode.LevelOrder: LevelOrderTraversal(root); break; default: throw new InvalidOperationException("Invalid Mode for Tree Traversal"); } }