binary tree structure, greedy alg