Building a binary tree of the minimum prices (T-Comm)