Algorithm For Optimal Binary Search Tree