# Python code to demonstrate deque
from collections import deque
# Declaring deque
queue = deque(['name','age','DOB'])
print(queue)
// CPP Program to implement Deque in STL
#include <deque>
#include <iostream>
using namespace std;
void showdq(deque<int> g)
{
deque<int>::iterator it;
for (it = g.begin(); it != g.end(); ++it)
cout << ' ' << *it;
cout << '
';
}
int main()
{
deque<int> gquiz;
gquiz.push_back(10);
gquiz.push_front(20);
gquiz.push_back(30);
gquiz.push_front(15);
cout << "The deque gquiz is : ";
showdq(gquiz);
cout << "
gquiz.size() : " << gquiz.size();
cout << "
gquiz.max_size() : " << gquiz.max_size();
cout << "
gquiz.at(2) : " << gquiz.at(2);
cout << "
gquiz.front() : " << gquiz.front();
cout << "
gquiz.back() : " << gquiz.back();
cout << "
gquiz.pop_front() : ";
gquiz.pop_front();
showdq(gquiz);
cout << "
gquiz.pop_back() : ";
gquiz.pop_back();
showdq(gquiz);
return 0;
}
# Python code to demonstrate deque
from collections import deque
# Declaring deque
queue = deque(['name','age','DOB'])
print(queue)
# Python code to demonstrate deque
from collections import deque
# Declaring deque
queue = deque(['name','age','DOB'])
print(queue)