C++ Easy || Two codes || Binary Searching
\n\n\n\n\n\n\n\nUsing recursion and binray Searching\n\n        TreeNode convertintoBST(vector nums,int left,int right)\n    {\n\t   //Base Case\n        if(lef
\n\n\n\n\n\n\n\n**Using recursion and binray Searching**\n\n        TreeNode* convertintoBST(vector<int> nums,int left,int right)\n    {\n\t   //Base Case\n        if(left > right) return NULL;\n\t\t//find mid\n        int mid = left+(right-left)/2;\n\t\t//create Node\n        TreeNode *node = new TreeNode(nums[mid]);\n\t\t//Set tree using recursion\n        node->left = convertintoBST(nums,left,mid-1);\n\t\t\n        node->right = convertintoBST(nums,mid+1,right);\n\t\t\n        return node;\n    }\n    TreeNode* sortedArrayToBST(vector<int>& nums) {\n        if(nums.size() == 0) return NULL;\n        return convertintoBST(nums,0,nums.size()-1);\n    }\n\t\n\t\n\t\n**Also use this**\n\n      // return NULL TreeNode if num is empty\n        if(!nums.size()) return NULL;\n\n        int mid = nums.size()/2;\n        TreeNode* head = new TreeNode(nums[mid]);\n        \n        // subvector left and right\n        vector<int> l(nums.begin(), nums.begin()+mid);\n        vector<int> r(nums.begin()+mid+1, nums.end());\n        \n        // set tree (using recursive)\n        head->left  = sortedArrayToBST(l);\n        head->right = sortedArrayToBST(r);\n        \n        return head;
['Binary Search Tree', 'C']