1. Unordered_set Declaration

2. insert()

3. begin() and end()

4. count()

5. find()

6. clear()

7. erase()

8. size()

9. wap()

10. empty()

11. operator ‘=”

12. bucket_count()

13. bucket()

14. bucket_size()


Example:


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    unordered_set<int> us; /// array
    /// unorder_unorder<int,greater<int>> s; /// descending  array
    us.insert(1);
    us.insert(2);
    us.insert(3);
    us.insert(4);
    us.insert(5);
    us.insert(4);
    us.insert(5);

    unordered_set<int> us2;
    us2.insert(11);
    us2.insert(12);
    us2.insert(13);
    us2.insert(14);

    unordered_set<int> us3 = {21, 22, 23, 24, 25};

    cout << "Size : " << us.size() << endl;
    // cout <<"Max_Size : "<< us.max_size() << endl;
    //  cout << "count  :" << us.count() << endl;
    // cout <<"empty : "<< us.empty() << endl;

    // began ()
    unordered_set<int>::iterator it;
    for (it = us.begin(); it!=us.end(); it++)
    {
        cout << *it << " ";
    }
   
    // print array
    for (auto it : us)
    {
        cout << it << " ";
        }

    // ⁡⁢⁣⁡⁢⁢⁢erase⁡

    unorder_unorder<int>::iterator it; /// iterator
    it = us.begin();
    advance(it, 3);    ///  insert index
    us.erase(it); /// delete hobe

    // ⁡⁢⁢⁢find⁡
    unorder_unorder_unorder_set<int>::iterator it; /// iterator
    it = us.find(3);
    if (it != us.end())
        cout << "Find" << endl;
    else
        cout << "Not Find" << endl;

    /// ⁡⁢⁣⁣count⁡

    int c = us.count(3);
    if (c = 1)
    {
        cout << "yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    for (auto it : us)
    {
        cout << it << " ";
    }

    // ⁡⁢⁣⁣lower bound⁡⁡

    unorder_unorder_unorder_set<int>::iterator it; /// iterator
    it = us.lower_bound(2);
    if (it == us.end())
        cout << "the element is larger to  the grater element" << endl;
    else
        cout << "the lower bound :" << *it << endl;

    // ⁡⁢⁣⁡⁢⁣⁣Upper bound⁡

   unorder_set<int>::iterator it; /// iterator
    it = us.upper_bound(2);
    if (it == us.end())
        cout << "the element is larger to  the grater element" << endl;
    else
        cout << "the upper bound :" << *it << endl;


    /// ⁡⁢⁣⁣ ⁡⁢⁣⁣normal iteration⁡⁡  ///

    unorder_unorder_set<int>::iterator it; /// iterator
    for (it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }

    s.insert(s.begin(),99);///  input number
     it = s.begin();
     advance(it, 3); ///  insert index
     s.insert(it, 2,9); ///  input number and koi bar print hobe

    s.erase(s3.begin());/// erase by index number
      it = s3.begin();
      advance(it, 3); ///  insert index
      s3.insert(it, 2,9); ///  input number and koi bar print hobe

    s3.remove(22);

    s4.sort();

     s3.unique();

    swap(s2, s3);

     s.merge(s3);

    swap(s, s2); /// swap between 2 array ;
       sort(s.begin(),s.end());
       sort(s.begin()+4,s.end());
       reserse(s.begin(),s.end());
       reserse(s.begin()+4,s.end());

    for (int i = 0; i < s.size(); i++)
    {
        cout << s[i] << " ";
    }

    sector<int>::iterator it;
    it = s.begin() + 5;
}