Queue


Queueは前後にアクセスできます.Stackよりアクセス性が優れています.FIFO(First-In-First-Out)
enqueue()
dequeue()
front()
size()
empty()

C++

#include <queue>
using std::queue; // make queue 
queue<float> myQueue;

size(): Return the number of elements in the queue. empty(): Return true if the queue is empty and false otherwise.
push(e): Enqueue e at the rear of the queue.
pop(): Dequeue the element at the front of the queue.
front(): Return a reference to the element at the queue’s front. 
back(): Return a reference to the element at the queue’s rear.
stl実装に加えて、Dequeの使用が便利です.
#include <deque>
deque<int> dq;
deque<int> dq(10); 010개 가지고는 것으로 시작
deque<int> dq(10,4); 410개 가지고 있는 deque

dq[];
dq.front();
dq.back();
dq.clear();
dq.push_front();
dq.push_back();
dq.pop_front();
dq.pop_back();

나머지는 vector 유사

Python


Pythonもdequeパッケージを使用
from collections import deque