generate binary tree