algorithms
algorithms copied to clipboard
Optimal BST
Finding optimal BST which keys are assigned weights (searching priorities), which cost of weights + depths(i) is minimum. Greedy solution is to pick the biggest weight node and place it in the root of the tree, but if both key and weight are max then resulting BST is unbalanced and not optimal
main has to work with inputs. + function must be tested better.