File tree 4 files changed +42
-0
lines changed
src/algorithms/linked-list
4 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1
1
# Reversed Linked List Traversal
2
2
3
+ _ Read this in other languages:_
4
+ [ 中文] ( README.zh-CN.md )
5
+
3
6
The task is to traverse the given linked list in reversed order.
4
7
5
8
For example for the following linked list:
Original file line number Diff line number Diff line change
1
+ # 链表倒序遍历
2
+
3
+ 我们的任务是倒序遍历给定的链表
4
+
5
+ 比如下面的链表
6
+
7
+ ![ ] ( https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg )
8
+
9
+ 遍历的顺序应该是
10
+
11
+ ``` text
12
+ 37 → 99 → 12
13
+ ```
14
+
15
+ 因为我们每个节点只访问一次,时间复杂度应该是` O(n) `
16
+
17
+ ## 参考
18
+
19
+ - [ Wikipedia] ( https://zh.wikipedia.org/wiki/%E9%93%BE%E8%A1%A8 )
Original file line number Diff line number Diff line change 2
2
3
3
_ Read this in other languages:_
4
4
[ _ Русский_ ] ( README.ru-RU.md )
5
+ [ 中文] ( README.zh-CN.md )
5
6
6
7
The task is to traverse the given linked list in straight order.
7
8
Original file line number Diff line number Diff line change
1
+ # 链表遍历
2
+
3
+ 我们的任务是顺序遍历给定的链表
4
+
5
+ 比如下面的链表
6
+
7
+ ![ Singly linked list] ( https://upload.wikimedia.org/wikipedia/commons/6/6d/Singly-linked-list.svg )
8
+
9
+ 遍历的顺序应该是
10
+
11
+ ``` text
12
+ 12 → 99 → 37
13
+ ```
14
+
15
+ 因为我们每个节点只访问一次,时间复杂度应该是` O(n) `
16
+
17
+ ## 参考
18
+
19
+ - [ Wikipedia] ( https://zh.wikipedia.org/wiki/%E9%93%BE%E8%A1%A8 )
You can’t perform that action at this time.
0 commit comments