Optimal Binary Search Tree Program In Python Using Loop