Template Function ADS::dfs(Tree<T> *, Pre&&, Post&&)

Function Documentation

template<class T, class Pre, class Post>
void ADS::dfs(Tree<T> *t, Pre &&pre, Post &&post)

dfs(): pre( u ) is called on each node before its subtrees are visited, post( u ) after; pre-visit() and post-visit() are dfs() with one of them.

It and in_visit() run with a stack of their own, not by recursion, so that the height of the tree may be n

Pre:

t is a node