Skip to content

Commit a188190

Browse files
committed
Deployed 5c900f2 with MkDocs version: 0.17.3
1 parent a838ab3 commit a188190

File tree

22 files changed

+674
-592
lines changed

22 files changed

+674
-592
lines changed

.DS_Store

6 KB
Binary file not shown.

00_课程简介之笨方法学算法/why_and_how_to_learn/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@
218218
<h1 id="_1">什么是算法和数据结构?</h1>
219219
<p>你可能会在一些教材上看到这句话:</p>
220220
<p>程序 = 算法 + 数据结构</p>
221-
<p>算法(Algorithm)是指解题方案的准确而完整的描述,是一系列解决问题的清晰指令,算法代表着用系统的方法描述解决问题的策略机制。也就是说,能够对一定规范的输入,在有限时间内获得所要求的输出。
222-
数据结构(Data Structures):是计算机存储和组织数据的一种方式,可以用来高效地处理数据。</p>
221+
<p>算法(Algorithm)是指解题方案的准确而完整的描述,是一系列解决问题的清晰指令,算法代表着用系统的方法描述解决问题的策略机制。也就是说,能够对一定规范的输入,在有限时间内获得所要求的输出。</p>
222+
<p>数据结构(Data Structures):是计算机存储和组织数据的一种方式,可以用来高效地处理数据。</p>
223223
<p>举个例子:二分查找就是一个非常经典的算法,而二分查找经常需要作用在一个有序数组上。这里二分就是一种折半的算法思想,
224224
而数组是我们最常用的一种数据结构,支持根据下标快速访问。很多算法需要特定的数据结构来实现,所以经常把它们放到一块讲。</p>
225225
<p>实际上,在真正的项目开发中,大部分时间都是 从数据库取数据 -&gt; 数据操作和结构化 -&gt; 返回给前端,在数据操作过程中需要合理地抽象,
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

03_链表/linked_list.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __len__(self):
3131
return self.length
3232

3333
def append(self, value): # O(1)
34-
if self.maxsize is not None and len(self) > self.maxsize:
34+
if self.maxsize is not None and len(self) >= self.maxsize:
3535
raise Exception('LinkedList is Full')
3636
node = Node(value) # 构造节点
3737
tailnode = self.tailnode
@@ -43,7 +43,7 @@ def append(self, value): # O(1)
4343
self.length += 1
4444

4545
def appendleft(self, value):
46-
if self.maxsize is not None and len(self) > self.maxsize:
46+
if self.maxsize is not None and len(self) >= self.maxsize:
4747
raise Exception('LinkedList is Full')
4848
headnode = self.root.next
4949
node = Node(value)
@@ -61,7 +61,8 @@ def iter_node(self):
6161
while curnode is not self.tailnode: # 从第一个节点开始遍历
6262
yield curnode
6363
curnode = curnode.next # 移动到下一个节点
64-
yield curnode
64+
if curnode is not None:
65+
yield curnode
6566

6667
def remove(self, value): # O(n)
6768
""" 删除包含值的一个节点,将其前一个节点的 next 指向被查询节点的下一个即可
@@ -113,6 +114,7 @@ def clear(self):
113114
del node
114115
self.root.next = None
115116
self.length = 0
117+
self.tailnode = None
116118

117119

118120
def test_linked_list():
@@ -151,6 +153,7 @@ def test_linked_list():
151153

152154
ll.clear()
153155
assert len(ll) == 0
156+
assert list(ll) == []
154157

155158

156159
def test_linked_list_remove():

03_链表/wnntest.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
# python linked_list.py
4+
when-changed . 'py.test -s linked_list.py'
5+
# when-changed . 'py.test -s double_link_list.py'
6+
# python double_link_list.py
Binary file not shown.
Binary file not shown.
Binary file not shown.
8.47 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,12 @@ <h2 id="_17">工具</h2>
427427
<p>每次我们改动了代码,就会自动执行代码里的单元测试了。pytest 会自动发现以 test 开头的函数并执行测试代码。</p>
428428
<h2 id="_18">勘误</h2>
429429
<p>输出其实也是一种再学习的过程,中途需要查看大量资料、编写讲义、视频录制、代码编写等,难免有疏漏甚至错误之处。
430-
有出版社找过笔者想让我出书,一来自己对出书兴趣不大,另外感觉书籍相对视频不够直观,有错误也不能及时修改,打算直接把所有
431-
文字内容讲义和代码等放到 github 上,供大家免费查阅。</p>
432-
<p>如果你发现文字内容、代码内容、视频内容有错误或者有疑问,欢迎在 github 上提 issue 讨论,或者直接提 Merge Request,我会修正相关内容,防止对读者产生误导。
433-
同时非常感谢认真学习并及时发现书中错误的同学,非常欢迎针对知识本身的交流和讨论,任何建议和修正我都会认真求证。</p>
430+
有出版社找过笔者想让我出书,一来自己对出书兴趣不大,另外感觉书籍相对视频不够直观,有错误也不能及时修改,打算直接把所有文字内容讲义和代码等放到 github 上,供大家免费查阅。</p>
431+
<p>如果你发现文字内容、代码内容、视频内容有错误或者有疑问,欢迎在 github 上提 issue 讨论(或者网易公开课评论区),或者直接提 Merge Request,我会尽量及时修正相关内容,防止对读者产生误导。
432+
同时非常感谢认真学习并及时发现书中错误的同学,非常欢迎针对知识本身的交流和讨论,任何建议和修正我都会认真求证。
433+
对于提出修正意见或者提交代码的同学,由于人数比较多这里就不一一列举了,可以在以下列表查看,再次感谢你们。笔者信奉开源精神,『眼睛足够多,bug 无处藏』。</p>
434+
<p><a href="https://github.com/PegasusWang/python_data_structures_and_algorithms/issues?q=is%3Aissue+is%3Aclosed">issue</a></p>
435+
<p><a href="https://github.com/PegasusWang/python_data_structures_and_algorithms/graphs/contributors">contributors</a></p>
434436
<h2 id="_19">如何提问?</h2>
435437
<p>如果读者关于代码、视频、讲义有任何疑问,欢迎一起讨论
436438
请注意以下几点:</p>
@@ -510,6 +512,6 @@ <h2 id="_20">本电子书制作和写作方式</h2>
510512
</html>
511513

512514
<!--
513-
MkDocs version : 0.17.4
514-
Build Date UTC : 2018-06-24 05:12:15
515+
MkDocs version : 0.17.3
516+
Build Date UTC : 2018-07-22 13:13:02
515517
-->

search/search_index.json

Lines changed: 557 additions & 557 deletions
Large diffs are not rendered by default.

sitemap.xml

Lines changed: 95 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,194 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3+
4+
35
<url>
46
<loc>/</loc>
5-
<lastmod>2018-06-24</lastmod>
7+
<lastmod>2018-07-22</lastmod>
68
<changefreq>daily</changefreq>
79
</url>
10+
11+
12+
813
<url>
914
<loc>/00_课程简介之笨方法学算法/why_and_how_to_learn/</loc>
10-
<lastmod>2018-06-24</lastmod>
15+
<lastmod>2018-07-22</lastmod>
1116
<changefreq>daily</changefreq>
1217
</url>
18+
19+
20+
1321
<url>
1422
<loc>/01_抽象数据类型和面向对象编程/ADT_OOP/</loc>
15-
<lastmod>2018-06-24</lastmod>
23+
<lastmod>2018-07-22</lastmod>
1624
<changefreq>daily</changefreq>
1725
</url>
26+
27+
28+
1829
<url>
1930
<loc>/02_数组和列表/array_and_list/</loc>
20-
<lastmod>2018-06-24</lastmod>
31+
<lastmod>2018-07-22</lastmod>
2132
<changefreq>daily</changefreq>
2233
</url>
34+
35+
36+
2337
<url>
2438
<loc>/03_链表/linked_list/</loc>
25-
<lastmod>2018-06-24</lastmod>
39+
<lastmod>2018-07-22</lastmod>
2640
<changefreq>daily</changefreq>
2741
</url>
42+
43+
44+
2845
<url>
2946
<loc>/04_队列/queue/</loc>
30-
<lastmod>2018-06-24</lastmod>
47+
<lastmod>2018-07-22</lastmod>
3148
<changefreq>daily</changefreq>
3249
</url>
50+
51+
52+
3353
<url>
3454
<loc>/05_栈/stack/</loc>
35-
<lastmod>2018-06-24</lastmod>
55+
<lastmod>2018-07-22</lastmod>
3656
<changefreq>daily</changefreq>
3757
</url>
58+
59+
60+
3861
<url>
3962
<loc>/06_算法分析/big_o/</loc>
40-
<lastmod>2018-06-24</lastmod>
63+
<lastmod>2018-07-22</lastmod>
4164
<changefreq>daily</changefreq>
4265
</url>
66+
67+
68+
4369
<url>
4470
<loc>/07_哈希表/hashtable/</loc>
45-
<lastmod>2018-06-24</lastmod>
71+
<lastmod>2018-07-22</lastmod>
4672
<changefreq>daily</changefreq>
4773
</url>
74+
75+
76+
4877
<url>
4978
<loc>/08_字典/dict/</loc>
50-
<lastmod>2018-06-24</lastmod>
79+
<lastmod>2018-07-22</lastmod>
5180
<changefreq>daily</changefreq>
5281
</url>
82+
83+
84+
5385
<url>
5486
<loc>/09_集合/set/</loc>
55-
<lastmod>2018-06-24</lastmod>
87+
<lastmod>2018-07-22</lastmod>
5688
<changefreq>daily</changefreq>
5789
</url>
90+
91+
92+
5893
<url>
5994
<loc>/10_递归/recursion/</loc>
60-
<lastmod>2018-06-24</lastmod>
95+
<lastmod>2018-07-22</lastmod>
6196
<changefreq>daily</changefreq>
6297
</url>
98+
99+
100+
63101
<url>
64102
<loc>/11_线性查找与二分查找/search/</loc>
65-
<lastmod>2018-06-24</lastmod>
103+
<lastmod>2018-07-22</lastmod>
66104
<changefreq>daily</changefreq>
67105
</url>
106+
107+
108+
68109
<url>
69110
<loc>/12_基本排序算法/basic_sort/</loc>
70-
<lastmod>2018-06-24</lastmod>
111+
<lastmod>2018-07-22</lastmod>
71112
<changefreq>daily</changefreq>
72113
</url>
114+
115+
116+
117+
73118
<url>
74119
<loc>/13_高级排序算法/advanced_sorting/</loc>
75-
<lastmod>2018-06-24</lastmod>
120+
<lastmod>2018-07-22</lastmod>
76121
<changefreq>daily</changefreq>
77122
</url>
123+
78124
<url>
79125
<loc>/13_高级排序算法/merge_sort/</loc>
80-
<lastmod>2018-06-24</lastmod>
126+
<lastmod>2018-07-22</lastmod>
81127
<changefreq>daily</changefreq>
82128
</url>
129+
83130
<url>
84131
<loc>/13_高级排序算法/quick_sort/</loc>
85-
<lastmod>2018-06-24</lastmod>
132+
<lastmod>2018-07-22</lastmod>
86133
<changefreq>daily</changefreq>
87134
</url>
135+
136+
137+
138+
88139
<url>
89140
<loc>/14_树与二叉树/tree/</loc>
90-
<lastmod>2018-06-24</lastmod>
141+
<lastmod>2018-07-22</lastmod>
91142
<changefreq>daily</changefreq>
92143
</url>
144+
145+
146+
93147
<url>
94148
<loc>/15_堆与堆排序/heap_and_heapsort/</loc>
95-
<lastmod>2018-06-24</lastmod>
149+
<lastmod>2018-07-22</lastmod>
96150
<changefreq>daily</changefreq>
97151
</url>
152+
153+
154+
98155
<url>
99156
<loc>/16_优先级队列/priority_queue/</loc>
100-
<lastmod>2018-06-24</lastmod>
157+
<lastmod>2018-07-22</lastmod>
101158
<changefreq>daily</changefreq>
102159
</url>
160+
161+
162+
103163
<url>
104164
<loc>/17_二叉查找树/binary_search_tree/</loc>
105-
<lastmod>2018-06-24</lastmod>
165+
<lastmod>2018-07-22</lastmod>
106166
<changefreq>daily</changefreq>
107167
</url>
168+
169+
170+
108171
<url>
109172
<loc>/18_图与图的遍历/graph/</loc>
110-
<lastmod>2018-06-24</lastmod>
173+
<lastmod>2018-07-22</lastmod>
111174
<changefreq>daily</changefreq>
112175
</url>
176+
177+
178+
113179
<url>
114180
<loc>/19_python内置常用算法和数据结构/builtins/</loc>
115-
<lastmod>2018-06-24</lastmod>
181+
<lastmod>2018-07-22</lastmod>
116182
<changefreq>daily</changefreq>
117183
</url>
184+
185+
186+
118187
<url>
119188
<loc>/20_面试指南/interview/</loc>
120-
<lastmod>2018-06-24</lastmod>
189+
<lastmod>2018-07-22</lastmod>
121190
<changefreq>daily</changefreq>
122191
</url>
192+
193+
123194
</urlset>

0 commit comments

Comments
 (0)