basic function of binary tree