CPP 3 lines Code Using DFS
Approach:\nSimply, just call the dfs function and in the dfs function, if root node is not null and val of root is not equal to the given value(val) then call t
**Approach:**\nSimply, just call the dfs function and in the dfs function, *if root node is not null and val of root is not equal to the given value(val) then call the dfs again and assign its value to root, if the root value is greater than the value to be searched then we call dfs for left half otherwise we call for right half* . \nAfter this we just return the root node. \n```\nC++ Code:\nTreeNode* dfs(TreeNode* root,int val)\n    {\n        if(root!=NULL && root->val!=val)\n           root=(root->val>val)?dfs(root->left,val):dfs(root->right,val);\n        return root;\n    }\n    TreeNode* searchBST(TreeNode* root, int val) {\n        return dfs(root,val);\n    }\n\t
['Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree']