before each tell command I give, first I make a heap of the ball kinds 
according to their number of balls of that kind. Then using this heap I 
construct a huffman tree as we saw in the lecture. Using this huffman tree I ask the 
nodes in the left subtree of current root. if the answer is yes my new search tree is 
the left subtree, otherwise right subtree is the new search tree. I do this until the 
root of my search tree is a single kind. Then I guess (tell) this kind. Then I free 
the nodes I allocated for huffman tree. I return to the beginning and again built a heap and 
huffman tree according to the changed number of balls of each kind. 
The general idea was the huffman coding because using Huffman coding at each guess 
minimizes the total sum of number_of_balls_of_this _kind*number_of_questions_to_reach_this_kind terms. 
So in general case this way of thinking minimizes the total number of questions.
