<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
is	O
a	O
linked	B-Application
data	I-Application
structure	I-Application
that	O
consists	O
of	O
a	O
set	O
of	O
sequentially	O
linked	O
records	O
called	O
nodes	B-Data_Structure
.	O
</s>
<s>
Each	O
node	O
contains	O
three	O
fields	O
:	O
two	O
link	O
fields	O
(	O
references	O
to	O
the	O
previous	O
and	O
to	O
the	O
next	O
node	O
in	O
the	O
sequence	O
of	O
nodes	B-Data_Structure
)	O
and	O
one	O
data	B-Application
field	I-Application
.	O
</s>
<s>
The	O
beginning	O
and	O
ending	O
nodes	B-Data_Structure
 '	O
previous	O
and	O
next	O
links	O
,	O
respectively	O
,	O
point	O
to	O
some	O
kind	O
of	O
terminator	O
,	O
typically	O
a	O
sentinel	B-Data_Structure
node	I-Data_Structure
or	O
null	O
,	O
to	O
facilitate	O
traversal	O
of	O
the	O
list	O
.	O
</s>
<s>
If	O
there	O
is	O
only	O
one	O
sentinel	B-Data_Structure
node	I-Data_Structure
,	O
then	O
the	O
list	O
is	O
circularly	O
linked	O
via	O
the	O
sentinel	B-Data_Structure
node	I-Data_Structure
.	O
</s>
<s>
It	O
can	O
be	O
conceptualized	O
as	O
two	O
singly	O
linked	B-Data_Structure
lists	I-Data_Structure
formed	O
from	O
the	O
same	O
data	O
items	O
,	O
but	O
in	O
opposite	O
sequential	O
orders	O
.	O
</s>
<s>
While	O
adding	O
or	O
removing	O
a	O
node	O
in	O
a	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
requires	O
changing	O
more	O
links	O
than	O
the	O
same	O
operations	O
on	O
a	O
singly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
,	O
the	O
operations	O
are	O
simpler	O
and	O
potentially	O
more	O
efficient	O
(	O
for	O
nodes	B-Data_Structure
other	O
than	O
first	O
nodes	B-Data_Structure
)	O
because	O
there	O
is	O
no	O
need	O
to	O
keep	O
track	O
of	O
the	O
previous	O
node	O
during	O
traversal	O
or	O
no	O
need	O
to	O
traverse	O
the	O
list	O
to	O
find	O
the	O
previous	O
node	O
,	O
so	O
that	O
its	O
link	O
can	O
be	O
modified	O
.	O
</s>
<s>
The	O
first	O
and	O
last	O
nodes	B-Data_Structure
of	O
a	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
for	O
all	O
practical	O
applications	O
are	O
immediately	O
accessible	O
(	O
i.e.	O
,	O
accessible	O
without	O
traversal	O
,	O
and	O
usually	O
called	O
head	O
and	O
tail	O
)	O
and	O
therefore	O
allow	O
traversal	O
of	O
the	O
list	O
from	O
the	O
beginning	O
or	O
end	O
of	O
the	O
list	O
,	O
respectively	O
:	O
e.g.	O
,	O
traversing	O
the	O
list	O
from	O
beginning	O
to	O
end	O
,	O
or	O
from	O
end	O
to	O
beginning	O
,	O
in	O
a	O
search	O
of	O
the	O
list	O
for	O
a	O
node	O
with	O
specific	O
data	O
value	O
.	O
</s>
<s>
Any	O
node	O
of	O
a	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
,	O
once	O
obtained	O
,	O
can	O
be	O
used	O
to	O
begin	O
a	O
new	O
traversal	O
of	O
the	O
list	O
,	O
in	O
either	O
direction	O
(	O
towards	O
beginning	O
or	O
end	O
)	O
,	O
from	O
the	O
given	O
node	O
.	O
</s>
<s>
The	O
link	O
fields	O
of	O
a	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
node	O
are	O
often	O
called	O
next	O
and	O
previous	O
or	O
forward	O
and	O
backward	O
.	O
</s>
<s>
The	O
references	O
stored	O
in	O
the	O
link	O
fields	O
are	O
usually	O
implemented	O
as	O
pointers	O
,	O
but	O
(	O
as	O
in	O
any	O
linked	B-Application
data	I-Application
structure	I-Application
)	O
they	O
may	O
also	O
be	O
address	O
offsets	O
or	O
indices	O
into	O
an	O
array	B-Data_Structure
where	O
the	O
nodes	B-Data_Structure
live	O
.	O
</s>
<s>
Traversal	O
of	O
a	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
can	O
be	O
in	O
either	O
direction	O
.	O
</s>
<s>
Traversal	O
is	O
often	O
called	O
iteration	B-Algorithm
,	O
but	O
that	O
choice	O
of	O
terminology	O
is	O
unfortunate	O
,	O
for	O
iteration	B-Algorithm
has	O
well-defined	O
semantics	O
(	O
e.g.	O
,	O
in	O
mathematics	O
)	O
which	O
are	O
not	O
analogous	O
to	O
traversal	O
.	O
</s>
<s>
Notice	O
that	O
we	O
also	O
do	O
n't	O
need	O
separate	O
"	O
removeBefore	O
"	O
or	O
"	O
removeAfter	O
"	O
methods	O
,	O
because	O
in	O
a	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
we	O
can	O
just	O
use	O
"	O
remove( 	O
node.prev	O
)	O
"	O
or	O
"	O
remove( 	O
node.next	O
)	O
"	O
where	O
these	O
are	O
valid	O
.	O
</s>
<s>
This	O
simple	O
function	O
inserts	O
a	O
node	O
into	O
a	O
doubly	O
linked	O
circularly	O
linked	B-Data_Structure
list	I-Data_Structure
after	O
a	O
given	O
element	O
:	O
</s>
<s>
As	O
in	O
doubly	B-Data_Structure
linked	I-Data_Structure
lists	I-Data_Structure
,	O
"	O
removeAfter	O
"	O
and	O
"	O
removeBefore	O
"	O
can	O
be	O
implemented	O
with	O
"	O
remove( list	O
,	O
node.prev	O
)	O
"	O
and	O
"	O
remove( list	O
,	O
node.next	O
)	O
"	O
.	O
</s>
<s>
An	O
asymmetric	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
is	O
somewhere	O
between	O
the	O
singly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
and	O
the	O
regular	O
doubly	B-Data_Structure
linked	I-Data_Structure
list	I-Data_Structure
.	O
</s>
<s>
While	O
this	O
makes	O
little	O
difference	O
between	O
nodes	B-Data_Structure
(	O
it	O
just	O
points	O
to	O
an	O
offset	O
within	O
the	O
previous	O
node	O
)	O
,	O
it	O
changes	O
the	O
head	O
of	O
the	O
list	O
:	O
It	O
allows	O
the	O
first	O
node	O
to	O
modify	O
the	O
firstNode	O
link	O
easily	O
.	O
</s>
