construct binary tree