/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode *sortedArrayToBST(vector<int> &num) {
return sortedArrayToBST(, num.size()-, num);
}
TreeNode *sortedArrayToBST(int left, int right, vector<int> &num){
if (left > right)
return NULL;
int mid = (left + right)/ + (left + right)% ;
TreeNode *root = new TreeNode(num[mid]);
root->left = sortedArrayToBST(left, mid-, num);
root->right = sortedArrayToBST(mid+, right, num);
return root;
}
};