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:
“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)
“Plot, rules, nor even poetry, are not half so great beauties in tragedy or comedy as a just imitation of nature, of character, of the passions and their operations in diversified situations.”
—Horace Walpole (17171797)
“You cant have operations without screams. Pain and the knifetheyre inseparable.”
—Jean Scott Rogers. Robert Day. Mr. Blount (Frank Pettingell)