EASY 2 APPROACHES || BFS, HASHING
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []

class FindElements {
public:
    Approach 1:
    vector<int>tree;
    FindElements(TreeNode* root) {
        root->val = 0;
        queue<TreeNode*>qu;
        qu.push(root);
        while(!qu.empty()){
            TreeNode* temp = qu.front();
            tree.push_back(temp->val);
            qu.pop();
            if(temp->left){
                temp->left->val = 2*(temp->val)+1;
                qu.push(temp->left);
            }
            if(temp->right){
                temp->right->val = 2*(temp->val)+2;
                qu.push(temp->right);
            }
        }
    }
    
    bool find(int target) {
        
        int low = 0;
        int high = tree.size()-1;
        while(low<=high){
            int mid = (low+high)/2;
            if(tree[mid]==target)return true;
            else if(tree[mid]<target) low=mid+1;
            else high = mid-1;
        }
        return false;
        
    }
};

    Approach 2:
    unordered_set<int> values; // Use a set for O(1) average time complexity for lookups

    FindElements(TreeNode* root) {
        if (root) {
            root->val = 0; 
            values.insert(0);
            queue<TreeNode*> qu;
            qu.push(root);
            while (!qu.empty()) {
                TreeNode* temp = qu.front();
                qu.pop();
                if (temp->left) {
                    temp->left->val = 2 * (temp->val) + 1; // Assign value to left child
                    values.insert(temp->left->val); // Insert into the set
                    qu.push(temp->left);
                }
                if (temp->right) {
                    temp->right->val = 2 * (temp->val) + 2; // Assign value to right child
                    values.insert(temp->right->val); // Insert into the set
                    qu.push(temp->right);
                }
            }
        }
    }
    
    bool find(int target) {
        return values.find(target) != values.end(); // Check if the target exists in the set
    }
};
```
['Hash Table', 'Tree', 'Breadth-First Search', 'Design', 'Binary Tree', 'C++']