Operations
The following operations are possible on a deque:
operation | common name(s) | Ada | C++ | Java | Perl | PHP | Python | Ruby | JavaScript |
---|---|---|---|---|---|---|---|---|---|
insert element at back | inject, snoc | Append |
push_back |
offerLast |
push |
array_push |
append |
push |
push |
insert element at front | push, cons | Prepend |
push_front |
offerFirst |
unshift |
array_unshift |
appendleft |
unshift |
unshift |
remove last element | eject | Delete_Last |
pop_back |
pollLast |
pop |
array_pop |
pop |
pop |
pop |
remove first element | pop | Delete_First |
pop_front |
pollFirst |
shift |
array_shift |
popleft |
shift |
shift |
examine last element | Last_Element |
back |
peekLast |
$array |
end |
|
last |
|
|
examine first element | First_Element |
front |
peekFirst |
$array |
reset |
|
first |
|
Read more about this topic: Double-ended Queue
Famous quotes containing the word operations:
“There is a patent office at the seat of government of the universe, whose managers are as much interested in the dispersion of seeds as anybody at Washington can be, and their operations are infinitely more extensive and regular.”
—Henry David Thoreau (18171862)
“It may seem strange that any road through such a wilderness should be passable, even in winter, when the snow is three or four feet deep, but at that season, wherever lumbering operations are actively carried on, teams are continually passing on the single track, and it becomes as smooth almost as a railway.”
—Henry David Thoreau (18171862)
“You cant have operations without screams. Pain and the knifetheyre inseparable.”
—Jean Scott Rogers. Robert Day. Mr. Blount (Frank Pettingell)