双端队列基本操作:
头文件:
#include <deque>
查询队头元素:O(1)
int x=Q.front();
查询队尾元素:O(1)
int x=Q.back();
从队头入队:O(1)
Q.push_front(5);
从队尾入队:O(1)
Q.push_back(7);
从队头出队:O(1)
Q.pop_front();
从队尾出队:O(1)
Q.pop_back();
清空队列:O(n)
Q.clear();
支持与vector类似的随机访问:O(1)
int x=Q[3];