C++ Both Linked List and vector implemetation
\n// implementation using vector\nclass MyHashSet\n{\npublic:\n    vector<int> m;\n    MyHashSet()\n    {\n        int s = 1e6 + 1;\n        m.resize(s);\n    }
```\n// implementation using vector\nclass MyHashSet\n{\npublic:\n    vector<int> m;\n    MyHashSet()\n    {\n        int s = 1e6 + 1;\n        m.resize(s);\n    }\n\n    void add(int key)\n    {\n        m[key] = 1;\n    }\n\n    void remove(int key)\n    {\n        m[key] = 0;\n    }\n\n    bool contains(int key)\n    {\n        return m[key];\n    }\n};\n```\n\n```\n// implementation using linked list chaining method\nclass MyHashSet\n{\npublic:\n    vector<list<int>> m;\n    int s;\n    MyHashSet()\n    {\n        // it can be used anything linked list will handle collision\n        s = 100;\n        m.resize(s);\n    }\n    // this is simple hash function\n    int hash(int key)\n    {\n        return key % s;\n    }\n    // this will return iterator to key\n    list<int>::iterator search(int key)\n    {\n        int i = hash(key);\n        return (find(m[i].begin(), m[i].end(), key));\n    }\n\n    void add(int key)\n    {\n        if (contains(key))\n            return;\n        int i = hash(key);\n        m[i].push_back(key);\n    }\n\n    void remove(int key)\n    {\n        if (!contains(key))\n            return;\n        int i = hash(key);\n        m[i].erase(search(key));\n    }\n\n    bool contains(int key)\n    {\n        int i = hash(key);\n        if (search(key) != m[i].end())\n            return true;\n        else\n            return false;\n    }\n};\n```
[]