问题
In reference to the problem HERE, how can we find the structure of optimal binary search tree. Author says:
In the above solutions, we have computed optimal cost only. The solutions can be easily modified to store the structure of BSTs also. We can create another auxiliary array of size n to store the structure of tree. All we need to do is, store the chosen ‘r’ in the innermost loop.
But above is not clear to me. Talking about loops, we start with chains of length 2,3 .. and so on. So let us say we store the value or r for chain of length 3 and onwards. How does it depict or help in getting tree structure ?
来源:https://stackoverflow.com/questions/28471909/find-optimal-binary-search-tree-structure