C++|| Two Solutions|| Recursion and Queue
Apporach 1: \nUsing Inorder Traversal\n\nclass Solution {\npublic:\n    int sum=0;\n    int rangeSumBST(TreeNode* root, int low, int high) {\n       if(root==NU
Apporach 1: \nUsing Inorder Traversal\n```\nclass Solution {\npublic:\n    int sum=0;\n    int rangeSumBST(TreeNode* root, int low, int high) {\n       if(root==NULL)\n        {\n            return sum;\n        }\n        rangeSumBST(root->left,low,high);\n         if(root->val>high){\n            return sum;\n        }\n        if(root->val>=low&&root->val<=high)\n        {\n            sum=sum+root->val;\n        }\n       rangeSumBST(root->right,low,high);\n        return sum;\n    }\n};\n```\n\nApproach 2:\nUsing Queue and property of BST:\nExplaination :\n1. Take a Queue data structure and push root to it;\n2. If node->val is in the range then both the subtrees can be in the range so we w\'ll add both left and right child : node->right and node->right to the queue.\n3. If the node->val is lower than (low) ,the left subtree will also be smaller than (low) but there is a possibility that its right child can be in the range , so we\'ll eliminate left subtree and add node->right to the queue.\n4. If the node->val is greater than (high),the rightt subtree will also be greater than (low) ,but  there is a possibility that its leftt child can be in the range , so we\'ll eliminate right subtree and add node->right to the queue.\n**CODE**\n```\n    int rangeSumBST(TreeNode* root, int low, int high) {\n        if(root==NULL)return 0;\n    int sum =0;\n        queue<TreeNode*>q;\n        q.push(root);\n        while(!q.empty()){\n          TreeNode* node=q.front();\n            q.pop();\n            if(node->val<low)\n            {\n                if(node->right!=NULL)q.push(node->right);\n            }\n            else if(node->val >high && node->left!=NULL){\n                q.push(node->left);                \n            }\n            else if(node->val>=low && node->val <=high){\n                sum+=(node->val);\n                if(node->left!=NULL)q.push(node->left);\n                if(node->right!=NULL)q.push(node->right);\n            } \n        }\n        return sum;\n    }\n\n```
['Binary Search Tree', 'Recursion', 'Queue']