1. Deque Declaration
  2. push_back()
  3. push_front()
  4. how to print deque
  5. front()
  6. back()
  7. pop_front(),
  8. pop_back()
  9. size()
  10. empty()
  11. clear()
  12. erase()
  13. insert()

Example:


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{

    ///////// Deque Declaration  ////////////⁡

    deque<int> dq;    /// array  declatation
    dq.push_back(1);  // dq(9)
    dq.push_back(2);  // dq(1)
    dq.push_back(3);  // dq
    dq.push_back(4);  // dq
    dq.push_back(5);  // dq
    dq.push_back(6);  // dq
    dq.push_back(7);  // dq
    dq.push_back(8);  // dq
    dq.push_back(9);  // dq
    dq.push_back(10); // dq

    deque<int> dq2;
    dq2.push_front(11);
    dq2.push_front(12);
    dq2.push_front(13);
    dq2.push_front(14);

    // deque<int>::iterator it; //NOTE -  iterator declatation

    /////////   array print ////////

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

    ///////// Front  ////////////⁡

     cout <<"Front : "<< dq.front() << endl;


     cout <<"Back  :"<< dq.back() << endl;


     cout <<"empty : "<< dq.empty() << endl;

    ///////// push pop  ////////////⁡

    dq.pop_back() ;
    dq.push_back(45) ;

    ///////// erase ////////////⁡

     dq.erase(dq.begin()+5 );/// erase by index number

    ///////// insert  ////////////⁡

     dq.insert(dq.begin()+5,99);///  insert index and input number

    ///////// Swap   ////////////⁡
   
    swap(dq, dq2); /// swap between 2 array ;
       sort(dq.begin(),dq.end());
       sort(dq.begin()+4,dq.end());
       redqerse(dq.begin(),dq.end());
       redqerse(dq.begin()+4,dq.end());

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

    deque<int>::iterator it;
    it = dq.begin() + 5;

    cout << "iteration : " << *it << endl;
    for (it = dq.begin(); it != dq.end(); it++)
    {
        cout << *it << " ";
}