```
TreeNode* sortedArrayToBST(vector<int>& nums) {
return makeTree(nums, 0, nums.size());
}
TreeNode* makeTree(vector<int>& nums, int s, int e) {
if (s >= e) {
return NULL;
}
int m = (e + s)/2;
TreeNode* root = new TreeNode(nums[m]);
root->left = makeTree(nums, s, m);
root->right = makeTree(nums, m +1, e);
return root;
}
```