Home

DequeaddFirste

DequeaddFirste is, in this article, a term used to describe the operation of inserting an element at the front of a double-ended queue (deque). The term is not standard in major programming libraries and may appear as a typographical variant or within hypothetical or educational contexts to illustrate the add-to-front operation.

Semantics: When invoked with element x, DequeaddFirste inserts x at the front, making x the first element;

Complexity: For a linked-list deque, the operation is O(1). For array-based deques using a circular buffer, it

Comparison: In common libraries, analogous methods are addFirst in Java's Deque, push in some stack implementations,

See also: Deque, addFirst, appendleft, push, circular buffer.

existing
elements
shift
backward
(in
array-backed
implementations)
or
pointers
are
updated
(in
linked-list-backed
implementations).
is
also
O(1)
amortized,
assuming
no
resizing.
If
the
underlying
storage
is
full,
a
resize
may
incur
O(n)
time,
but
subsequent
insertions
remain
O(1).
Space
complexity
is
O(1)
extra
beyond
the
element
itself,
plus
the
underlying
storage.
or
appendleft
in
Python's
collections.deque.
The
exact
name
DequeaddFirste
is
not
standard.