Skip to content

Commit 288b907

Browse files
committed
Deployed 0a1ff5c with MkDocs version: 1.0.4
1 parent 605afdd commit 288b907

File tree

9 files changed

+90
-32
lines changed

9 files changed

+90
-32
lines changed

03_链表/linked_list/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,10 @@ <h1 id="_5">相关阅读</h1>
350350
<h1 id="_6">勘误:</h1>
351351
<p>视频中 LinkedList.remove 方法讲解有遗漏, linked_list.py 文件已经修正,请读者注意。具体请参考 <a href="https://github.com/PegasusWang/python_data_structures_and_algorithms/pull/3">fix linked_list &amp; add gitigonre</a>。视频最后增加了一段勘误说明。</p>
352352
<h1 id="leetcode">Leetcode</h1>
353+
<p>反转链表 <a href="https://leetcode.com/problems/reverse-linked-list/">reverse-linked-list</a></p>
353354
<p>这里有一道关于 LRU 的练习题你可以尝试下。
354355
<a href="https://leetcode.com/problems/lru-cache/description/">LRU Cache</a></p>
356+
<p>合并两个有序链表 <a href="/https://leetcode.com/problems/merge-two-sorted-lists/submissions/">merge-two-sorted-lists</a></p>
355357

356358
</div>
357359
</div>

04_队列/queue.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# -*- coding: utf-8 -*-
22

3+
from collections import deque
34

45
# NOTE:注意这里是第三章 linked_list.py 里的内容,为了使文件自包含,我直接拷贝过来的
6+
7+
58
class Node(object):
69
def __init__(self, value=None, next=None): # 这里我们 root 节点默认都是 None,所以都给了默认值
710
self.value = value
@@ -154,3 +157,26 @@ def test_queue():
154157
with pytest.raises(EmptyError) as excinfo: # 我们来测试是否真的抛出了异常
155158
q.pop() # 继续调用会抛出异常
156159
assert 'empty queue' == str(excinfo.value)
160+
161+
162+
class MyQueue:
163+
"""
164+
使用 collections.deque 可以迅速实现一个队列
165+
"""
166+
def __init__(self):
167+
self.items = deque()
168+
169+
def append(self, val):
170+
return self.items.append(val)
171+
172+
def pop(self):
173+
return self.items.popleft()
174+
175+
def __len__(self):
176+
return len(self.items)
177+
178+
def empty(self):
179+
return len(self.items) == 0
180+
181+
def front(self):
182+
return self.items[0]

14_树与二叉树/btree.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ def inorder_trav(self, subtree):
8585
print(subtree.data)
8686
self.inorder_trav(subtree.right)
8787

88+
def yield_inorder(self, subtree): # for val in yield_inorder(root): print(val)
89+
if subtree:
90+
yield from self.inorder(subtree.left)
91+
yield subtree.val
92+
yield from self.inorder(subtree.right)
93+
8894
def reverse(self, subtree):
8995
if subtree is not None:
9096
subtree.left, subtree.right = subtree.right, subtree.left

14_树与二叉树/tree/index.html

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
<li class="toctree-l2"><a href="#_10">延伸阅读</a></li>
183183

184184

185-
<li class="toctree-l2"><a href="#leetcode">Leetcode</a></li>
185+
<li class="toctree-l2"><a href="#leetcode">Leetcode 练习</a></li>
186186

187187

188188
</ul>
@@ -480,17 +480,36 @@ <h1 id="_9">练习题</h1>
480480
<li>树的遍历我们用了 print,请你尝试换成一个 callback,这样就能自定义处理树节点的方式了。</li>
481481
<li>请问树的遍历操作时间复杂度是多少?假设它的 size 是 n</li>
482482
<li>你能用非递归的方式来实现树的遍历吗?我们知道计算机内部使用了 stack,如果我们自己模拟如何实现?请你尝试完成</li>
483+
<li>只根据二叉树的中序遍历和后序遍历能否确定一棵二叉树?你可以举一个反例吗?</li>
483484
</ul>
484485
<h1 id="_10">延伸阅读</h1>
485486
<ul>
486487
<li>《Data Structures and Algorithms in Python》 13 章 Binary Trees</li>
487488
<li><a href="https://www.geeksforgeeks.org/iterative-preorder-traversal/">https://www.geeksforgeeks.org/iterative-preorder-traversal/</a></li>
488489
</ul>
489-
<h1 id="leetcode">Leetcode</h1>
490-
<p>使用树的层序遍历我们能实现一个树的左右视图,比如从一个二叉树的左边能看到哪些节点。
491-
请你尝试做这个练习题 https://leetcode.com/problems/binary-tree-right-side-view/description/</p>
492-
<p>根据二叉树的 前序和后序遍历,返回一颗完整的二叉树。
493-
https://leetcode.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal/submissions/</p>
490+
<h1 id="leetcode">Leetcode 练习</h1>
491+
<ul>
492+
<li>
493+
<p><a href="https://leetcode.com/problems/binary-tree-preorder-traversal/">leetcode binary-tree-preorder-traversal</a>
494+
二叉树的先序遍历</p>
495+
</li>
496+
<li>
497+
<p><a href="https://leetcode.com/problems/binary-tree-inorder-traversal/">leetcode binary-tree-inorder-traversal/</a>
498+
二叉树的中序遍历</p>
499+
</li>
500+
<li>
501+
<p><a href="https://leetcode.com/problems/binary-tree-postorder-traversal/">leetcode binary-tree-postorder-traversal</a>
502+
二叉树的后序遍历</p>
503+
</li>
504+
<li>
505+
<p><a href="https://leetcode.com/problems/binary-tree-right-side-view/description/">leetcode binary-tree-right-side-view</a>
506+
使用树的层序遍历我们能实现一个树的左右视图,比如从一个二叉树的左边能看到哪些节点。 请你尝试做这个练习题</p>
507+
</li>
508+
<li>
509+
<p><a href="https://leetcode.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal/submissions/">leetcode construct-binary-tree-from-preorder-and-postorder-traversal</a>
510+
根据二叉树的 前序和后序遍历,返回一颗完整的二叉树。</p>
511+
</li>
512+
</ul>
494513

495514
</div>
496515
</div>

17_二叉查找树/binary_search_tree/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@
190190
<li class="toctree-l2"><a href="#_9">延伸阅读</a></li>
191191

192192

193+
<li class="toctree-l2"><a href="#leetcode">Leetcode</a></li>
194+
195+
193196
</ul>
194197
</li>
195198

@@ -448,6 +451,8 @@ <h1 id="_9">延伸阅读</h1>
448451
<li>了解红黑树。普通二叉查找树有个很大的问题就是难以保证树的平衡,极端情况下某些节点可能会非常深,导致查找复杂度大幅退化。而平衡二叉树就是为了解决这个问题。请搜索对应资料了解下。</li>
449452
<li>了解 mysql 索引使用的 B-Tree 结构(多路平衡查找树),这个是后端面试数据库的常考点。想想为什么?当元素非常多的时候,二叉树的深度会很深,导致多次磁盘查找。<a href="https://blog.csdn.net/v_JULY_v/article/details/6530142">从B树、B+树、B*树谈到R 树</a></li>
450453
</ul>
454+
<h1 id="leetcode">Leetcode</h1>
455+
<p>验证是否是合法二叉搜索树 [validate-binary-search-tree](https://leetcode.com/problems/validate-binary-search-tree/</p>
451456

452457
</div>
453458
</div>

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,5 +581,5 @@ <h2 id="_21">本电子书制作和写作方式</h2>
581581

582582
<!--
583583
MkDocs version : 1.0.4
584-
Build Date UTC : 2018-12-26 07:57:35
584+
Build Date UTC : 2019-01-09 03:17:34
585585
-->

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

sitemap.xml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,122 +2,122 @@
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
33
<url>
44
<loc>None</loc>
5-
<lastmod>2018-12-26</lastmod>
5+
<lastmod>2019-01-09</lastmod>
66
<changefreq>daily</changefreq>
77
</url>
88
<url>
99
<loc>None</loc>
10-
<lastmod>2018-12-26</lastmod>
10+
<lastmod>2019-01-09</lastmod>
1111
<changefreq>daily</changefreq>
1212
</url>
1313
<url>
1414
<loc>None</loc>
15-
<lastmod>2018-12-26</lastmod>
15+
<lastmod>2019-01-09</lastmod>
1616
<changefreq>daily</changefreq>
1717
</url>
1818
<url>
1919
<loc>None</loc>
20-
<lastmod>2018-12-26</lastmod>
20+
<lastmod>2019-01-09</lastmod>
2121
<changefreq>daily</changefreq>
2222
</url>
2323
<url>
2424
<loc>None</loc>
25-
<lastmod>2018-12-26</lastmod>
25+
<lastmod>2019-01-09</lastmod>
2626
<changefreq>daily</changefreq>
2727
</url>
2828
<url>
2929
<loc>None</loc>
30-
<lastmod>2018-12-26</lastmod>
30+
<lastmod>2019-01-09</lastmod>
3131
<changefreq>daily</changefreq>
3232
</url>
3333
<url>
3434
<loc>None</loc>
35-
<lastmod>2018-12-26</lastmod>
35+
<lastmod>2019-01-09</lastmod>
3636
<changefreq>daily</changefreq>
3737
</url>
3838
<url>
3939
<loc>None</loc>
40-
<lastmod>2018-12-26</lastmod>
40+
<lastmod>2019-01-09</lastmod>
4141
<changefreq>daily</changefreq>
4242
</url>
4343
<url>
4444
<loc>None</loc>
45-
<lastmod>2018-12-26</lastmod>
45+
<lastmod>2019-01-09</lastmod>
4646
<changefreq>daily</changefreq>
4747
</url>
4848
<url>
4949
<loc>None</loc>
50-
<lastmod>2018-12-26</lastmod>
50+
<lastmod>2019-01-09</lastmod>
5151
<changefreq>daily</changefreq>
5252
</url>
5353
<url>
5454
<loc>None</loc>
55-
<lastmod>2018-12-26</lastmod>
55+
<lastmod>2019-01-09</lastmod>
5656
<changefreq>daily</changefreq>
5757
</url>
5858
<url>
5959
<loc>None</loc>
60-
<lastmod>2018-12-26</lastmod>
60+
<lastmod>2019-01-09</lastmod>
6161
<changefreq>daily</changefreq>
6262
</url>
6363
<url>
6464
<loc>None</loc>
65-
<lastmod>2018-12-26</lastmod>
65+
<lastmod>2019-01-09</lastmod>
6666
<changefreq>daily</changefreq>
6767
</url>
6868
<url>
6969
<loc>None</loc>
70-
<lastmod>2018-12-26</lastmod>
70+
<lastmod>2019-01-09</lastmod>
7171
<changefreq>daily</changefreq>
7272
</url>
7373
<url>
7474
<loc>None</loc>
75-
<lastmod>2018-12-26</lastmod>
75+
<lastmod>2019-01-09</lastmod>
7676
<changefreq>daily</changefreq>
7777
</url>
7878
<url>
7979
<loc>None</loc>
80-
<lastmod>2018-12-26</lastmod>
80+
<lastmod>2019-01-09</lastmod>
8181
<changefreq>daily</changefreq>
8282
</url>
8383
<url>
8484
<loc>None</loc>
85-
<lastmod>2018-12-26</lastmod>
85+
<lastmod>2019-01-09</lastmod>
8686
<changefreq>daily</changefreq>
8787
</url>
8888
<url>
8989
<loc>None</loc>
90-
<lastmod>2018-12-26</lastmod>
90+
<lastmod>2019-01-09</lastmod>
9191
<changefreq>daily</changefreq>
9292
</url>
9393
<url>
9494
<loc>None</loc>
95-
<lastmod>2018-12-26</lastmod>
95+
<lastmod>2019-01-09</lastmod>
9696
<changefreq>daily</changefreq>
9797
</url>
9898
<url>
9999
<loc>None</loc>
100-
<lastmod>2018-12-26</lastmod>
100+
<lastmod>2019-01-09</lastmod>
101101
<changefreq>daily</changefreq>
102102
</url>
103103
<url>
104104
<loc>None</loc>
105-
<lastmod>2018-12-26</lastmod>
105+
<lastmod>2019-01-09</lastmod>
106106
<changefreq>daily</changefreq>
107107
</url>
108108
<url>
109109
<loc>None</loc>
110-
<lastmod>2018-12-26</lastmod>
110+
<lastmod>2019-01-09</lastmod>
111111
<changefreq>daily</changefreq>
112112
</url>
113113
<url>
114114
<loc>None</loc>
115-
<lastmod>2018-12-26</lastmod>
115+
<lastmod>2019-01-09</lastmod>
116116
<changefreq>daily</changefreq>
117117
</url>
118118
<url>
119119
<loc>None</loc>
120-
<lastmod>2018-12-26</lastmod>
120+
<lastmod>2019-01-09</lastmod>
121121
<changefreq>daily</changefreq>
122122
</url>
123123
</urlset>

sitemap.xml.gz

-1 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)