Optimal Binary Search Tree Dynamic Programming
In this problem, we discuss the Optimal Binary Search Tree using dynamic programming. In this problem, 1. You are given two arrays - The first array(keys), which is sorted and has distinct integers, represents search keys. Second one(freq) represents frequency counts, where freq[i] is the number of searches to keys[i]. 2. A binary search tree is constructed containing all keys and the total cost of searches is minimum. 3. The cost of a BST node is the level of that node multiplied by its frequency. 4. You have to find the minimum cost of all searches.