@@ -4,26 +4,27 @@ _Read this in other languages:_
4
4
[ _ Русский_ ] ( README.ru-RU.md ) ,
5
5
[ _ 简体中文_ ] ( README.zh-CN.md ) ,
6
6
[ _ 日本語_ ] ( README.ja-JP.md ) ,
7
- [ _ Português_ ] ( README.pt-BR.md )
8
- [ _ 한국어_ ] ( README.ko-KR.md )
9
-
10
- In computer science, a ** doubly linked list** is a linked data structure that
11
- consists of a set of sequentially linked records called nodes. Each node contains
12
- two fields, called links, that are references to the previous and to the next
13
- node in the sequence of nodes. The beginning and ending nodes' previous and next
14
- links, respectively, point to some kind of terminator, typically a sentinel
15
- node or null, to facilitate the traversal of the list. If there is only one
16
- sentinel node, then the list is circularly linked via the sentinel node. It can
17
- be conceptualized as two singly linked lists formed from the same data items,
7
+ [ _ Português_ ] ( README.pt-BR.md ) ,
8
+ [ _ 한국어_ ] ( README.ko-KR.md ) ,
9
+ [ _ Español_ ] ( README.es-ES.md ) ,
10
+
11
+ In computer science, a ** doubly linked list** is a linked data structure that
12
+ consists of a set of sequentially linked records called nodes. Each node contains
13
+ two fields, called links, that are references to the previous and to the next
14
+ node in the sequence of nodes. The beginning and ending nodes' previous and next
15
+ links, respectively, point to some kind of terminator, typically a sentinel
16
+ node or null, to facilitate the traversal of the list. If there is only one
17
+ sentinel node, then the list is circularly linked via the sentinel node. It can
18
+ be conceptualized as two singly linked lists formed from the same data items,
18
19
but in opposite sequential orders.
19
20
20
21
![ Doubly Linked List] ( https://upload.wikimedia.org/wikipedia/commons/5/5e/Doubly-linked-list.svg )
21
22
22
- The two node links allow traversal of the list in either direction. While adding
23
- or removing a node in a doubly linked list requires changing more links than the
24
- same operations on a singly linked list, the operations are simpler and
25
- potentially more efficient (for nodes other than first nodes) because there
26
- is no need to keep track of the previous node during traversal or no need
23
+ The two node links allow traversal of the list in either direction. While adding
24
+ or removing a node in a doubly linked list requires changing more links than the
25
+ same operations on a singly linked list, the operations are simpler and
26
+ potentially more efficient (for nodes other than first nodes) because there
27
+ is no need to keep track of the previous node during traversal or no need
27
28
to traverse the list to find the previous node, so that its link can be modified.
28
29
29
30
## Pseudocode for Basic Operations
@@ -45,7 +46,7 @@ Add(value)
45
46
end if
46
47
end Add
47
48
```
48
-
49
+
49
50
### Delete
50
51
51
52
``` text
@@ -82,7 +83,7 @@ Remove(head, value)
82
83
return false
83
84
end Remove
84
85
```
85
-
86
+
86
87
### Reverse Traversal
87
88
88
89
``` text
@@ -96,7 +97,7 @@ ReverseTraversal(tail)
96
97
end while
97
98
end Reverse Traversal
98
99
```
99
-
100
+
100
101
## Complexities
101
102
102
103
## Time Complexity
0 commit comments