#include <iostream>
#include <vector>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
TreeNode* createbst(vector<int> &a, int lhs, int rhs)
{
if(lhs <= rhs)
{
int mid = (lhs + rhs) >> 1;
TreeNode *root = new TreeNode(a[mid]);
root->left = createbst(a, lhs, mid-1);
root->right = createbst(a, mid+1, rh......
阅读全文