Pergunta de entrevista da empresa Samsung Electronics

Given a binary tree and some operations, we need to minimize the cost such that the tree is a binary search tree.