serialize, diameter of binary tree