1. #include<bits/stdc++.h>
  2. 4 types
    1. algo
      1. SORT

        1. SORT(A,A + N)
        2. SORT(A.BEGIN(),A.END())
        3. SORT(A+2,A+5)
      2. DECENDING

        1. SORT(A, A+N, greater<int>)
      3. sort my way

        1. sort(a,a+n,comp);

          1. this comp is a bool function

          Untitled

    2. containers
      1. pairs

        1. pair<int,int> p = {1,2}
        2. p.first, p.second
        3. pair<int,int> arr[] = {{1,2},{2,3}}
      2. vectors

        1. vector<int> v;
        2. v.push_back(2);
        3. vector<int> v(5,100) ⇒ {100,100,100,100,100};
        4. vector<int> v2(v1) ⇒ it will be a copy of it.
        5. access vector ⇒
          1. v[1],v[3]
          2. v.back()’
          3. for(auto i : v){
          4. cout<<i<<endl;
          5. }
        6. erase function
          1. v.erase(v.begin + 1);
          2. v.erase( starting add, end address) //v.begin() +1, v.begin() + 3
        7. Insert function
          1. vector<int> v(2,100) = >{100,100}
          2. v.insert(v.begin(),300)
          3. v.insert(v.begin(),copy.begin(),copy.end()) ⇒ copy the entire vector
        8. cout<< v.size()
        9. v.pop_back()
        10. v1.swap(v2)
        11. v.clear()
        12. v.empty()
      3. List

        1. similar to vector but it also gives you front opertaions
        2. list<int> l;
        3. l.push_back();
        4. l.push_front();
      4. dequeue

        1. push_back
        2. push_front
        3. pop_back
        4. pop_front
        5. dq.back()
        6. dq.front()
      5. stack

        1. lifo

        2. .push(1);

        3. st.top();

        4. st.pop();

        5. size()

        6. empty()

          Untitled

      6. queue

        1. push
        2. q.back()
        3. q.front()
        4. q.pop()
      7. priority_queue // max heap //logn

        1. priority_queue<int>pq;

          Untitled

        2. .top()

        3. .pop()

        4. .push()

        5. minimum heap

          Untitled

      8. set

        1. sorted, unique
        2. .insert(1)
        3. st.find(3) ⇒ if not there, it return iterator of st.end()
        4. st.erase(5)⇒ element or iterator
        5. st.count(1) ⇒ no of 1
      9. multiset<int>ms;

        1. sorted, many items
        2. ms.count(1)
        3. ms.erase(ms.find(1));
      10. unordered_set<int> st;

        1. unique, notsorted
      11. Map LOGN

        1. dictionary
        2. keys → unique
        3. map<int,int> mpp;
          1. map[1] = 1;
          2. mapp[{2,3}] = 4;
        4. for(auto i : mpp){
        5. mpp.first, mpp.second
        6. }
        7. multimap → mpp[key] not accessable;
          1. it can store multiple keys
        8. unordered_map
          1. unique keys; not sorted; o(1)
    3. functions
    4. iterators