Template Function ADS::optimalSearchTree(const std::vector<T>&, const std::vector<T>&)

Function Documentation

template<class T>
OptimalSearchTree<T> ADS::optimalSearchTree(const std::vector<T> &p, const std::vector<T> &q)

the optimal binary search tree of the keys of weights p and of the gaps of weights q

Pre:

p and q not negative, |q| = |p| + 1

Post:

a tree whose symmetric visit is 0 .. n - 1, of the cost found