Skip to content

Commit 97dd96a

Browse files
authored
Add doubly-linked-list doc in Korean (trekhleb#449)
1 parent 30ef6a3 commit 97dd96a

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Doubly Linked List
2+
3+
_Read this in other languages:_
4+
[_Русский_](README.ru-RU.md),
5+
[_简体中文_](README.zh-CN.md),
6+
[_日本語_](README.ja-JP.md),
7+
[_Português_](README.pt-BR.md)
8+
9+
컴퓨터공학에서 **이중 연결 리스트**는 순차적으로 링크된 노드라는 레코드 세트로 구성된 링크된 데이터 구조입니다.
10+
각 노드에는 링크라고 하는 두 개의 필드가 있으며, 노드 순서에서 이전 노드와 다음 노드에 대한 참조를 가집니다.
11+
시작 및 종료 노드의 이전 및 다음 링크는 각각 리스트의 순회를 용이하게 하기 위해서 일종의 종결자 (일반적으로 센티넬노드 또는 null)를 나타냅니다.
12+
센티넬 노드가 하나만 있으면, 목록이 센티넬 노드를 통해서 원형으로 연결됩니다.
13+
동일한 데이터 항목으로 구성되어 있지만, 반대 순서로 두 개의 단일 연결 리스트로 개념화 할 수 있습니다.
14+
15+
![이중 연결 리스트](https://upload.wikimedia.org/wikipedia/commons/5/5e/Doubly-linked-list.svg)
16+
17+
두 개의 노드 링크를 사용하면 어느 방향으로든 리스트를 순회할 수 있습니다.
18+
이중 연결 리스트에서 노드를 추가하거나 제거하려면, 단일 연결 리스트에서 동일한 작업보다 더 많은 링크를 변경해야 하지만, 첫 번째 노드 이외의 노드인 경우 작업을 추적할 필요가 없으므로 작업이 더 단순해져 잠재적으로 더 효율적입니다.
19+
리스트 순회 중 이전 노드 또는 링크를 수정할 수 있도록 이전 노드를 찾기 위해 리스트를 순회할 필요가 없습니다.
20+
21+
## 기본 동작을 위한 Pseudocode
22+
23+
### 삽입
24+
25+
```text
26+
Add(value)
27+
Pre: value는 리스트에 추가하고자 하는 값
28+
Post: value는 목록의 끝에 배치됨
29+
n ← node(value)
30+
if head = ø
31+
head ← n
32+
tail ← n
33+
else
34+
n.previous ← tail
35+
tail.next ← n
36+
tail ← n
37+
end if
38+
end Add
39+
```
40+
41+
### 삭제
42+
43+
```text
44+
Remove(head, value)
45+
Pre: head는 리스트의 앞단에 위치
46+
value는 리스트에서 제거하고자 하는 값
47+
Post: value가 리스트에서 제거되면 true; 아니라면 false;
48+
if head = ø
49+
return false
50+
end if
51+
if value = head.value
52+
if head = tail
53+
head ← ø
54+
tail ← ø
55+
else
56+
head ← head.next
57+
head.previous ← ø
58+
end if
59+
return true
60+
end if
61+
n ← head.next
62+
while n = ø and value !== n.value
63+
n ← n.next
64+
end while
65+
if n = tail
66+
tail ← tail.previous
67+
tail.next ← ø
68+
return true
69+
else if n = ø
70+
n.previous.next ← n.next
71+
n.next.previous ← n.previous
72+
return true
73+
end if
74+
return false
75+
end Remove
76+
```
77+
78+
### 역순회
79+
80+
```text
81+
ReverseTraversal(tail)
82+
Pre: tail은 리스트에서 순회하고자 하는 노드
83+
Post: 리스트가 역순으로 순회됨
84+
n ← tail
85+
while n = ø
86+
yield n.value
87+
n ← n.previous
88+
end while
89+
end Reverse Traversal
90+
```
91+
92+
## 복잡도
93+
94+
## 시간 복잡도
95+
96+
| Access | Search | Insertion | Deletion |
97+
| :-------: | :-------: | :-------: | :-------: |
98+
| O(n) | O(n) | O(1) | O(n) |
99+
100+
### 공간 복잡도
101+
102+
O(n)
103+
104+
## 참고
105+
106+
- [Wikipedia](https://en.wikipedia.org/wiki/Doubly_linked_list)
107+
- [YouTube](https://www.youtube.com/watch?v=JdQeNxWCguQ&t=7s&index=72&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)

src/data-structures/doubly-linked-list/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ _Read this in other languages:_
55
[_简体中文_](README.zh-CN.md),
66
[_日本語_](README.ja-JP.md),
77
[_Português_](README.pt-BR.md)
8+
[_한국어_](README.ko-KR.md)
89

910
In computer science, a **doubly linked list** is a linked data structure that
1011
consists of a set of sequentially linked records called nodes. Each node contains

0 commit comments

Comments
 (0)