struct TreeNode* sortedArrayToBST(int* nums, int numsSize){ struct TreeNode* p_node=(struct TreeNode*)malloc(sizeof(struct TreeNode)); if(0==numsSize || NULL==nums) return NULL; int mid=numsSize/2; p_node->val=nums[mid]; p_node->left=sortedArrayToBST(nums,mid); p_node->right=sortedArrayToBST(&nums[mid+1],numsSize-mid-1); return p_node; }