We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1181274 commit 102b075Copy full SHA for 102b075
docs/03_链表/linked_list.md
@@ -78,11 +78,14 @@ cdll.remove(node),注意这里参数是 node | O(1) |
78
cdll.headnode() | O(1) |
79
cdll.tailnode() | O(1) |
80
81
+
82
# 小问题:
83
- 这里单链表我没有实现 insert 方法,你能自己尝试实现吗? insert(value, new_value),我想在某个值之前插入一个值。你同样需要先查找,所以这个步骤也不够高效。
84
- 你能尝试自己实现个 lru cache 吗?需要使用到我们这里提到的循环双端链表
85
+- 借助内置的 collections.OrderedDict,它有两个方法 popitem 和 move_to_end,我们可以迅速实现一个 LRU cache。请你尝试用 OrderedDict 来实现。
86
- python 内置库的哪些数据结构使用到了本章讲的链式结构?
87
88
89
# 相关阅读
90
91
[那些年,我们一起跪过的算法题- Lru cache[视频]](https://zhuanlan.zhihu.com/p/35175401)
@@ -93,4 +96,5 @@ cdll.tailnode() | O(1) |
93
96
94
97
# Leetcode
95
98
99
+这里有一道关于 LRU 的练习题你可以尝试下。
100
[LRU Cache](https://leetcode.com/problems/lru-cache/description/)
0 commit comments