Skip to content

Commit 4c54bf5

Browse files
committed
Deployed c665e06 with MkDocs version: 0.17.3
1 parent 81a4014 commit 4c54bf5

File tree

7 files changed

+32
-29
lines changed

7 files changed

+32
-29
lines changed

10_递归/recursion/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ <h1 id="_8">思考题</h1>
404404
<li>实现一个 flatten 函数,把嵌套的列表扁平化,你需要用递归函数来实现。比如 [[1,2], [1,2,3] -&gt; [1,2,1,2,3]</li>
405405
<li>使用递归和循环各有什么优缺点,你能想到吗?怎么把一个尾递归用迭代替换?</li>
406406
<li>递归有时候虽然很优雅直观,但是时间复杂度却不理想,比如斐波那契数列,它的表达式是 F(n) = F(n-1) + F(n-2),你能计算它的时间复杂度吗?请你画个树来表示它的计算过程,为什么这个时间复杂度很不理想?我们怎样去优化它。</li>
407+
<li>python 内置的 dict 只能用 dict['key'] 的形式访问比较麻烦,我们想用 dict.key 的形式访问。tornado web 框架中提供了一个 ObjectDict,请你实现一个递归函数接收一个字典,并返回一个可以嵌套访问的 ObjectDict</li>
407408
</ul>
408409

409410
</div>

13_高级排序算法/partition.png

98.3 KB
Loading

13_高级排序算法/quick_sort.png

92.3 KB
Loading

13_高级排序算法/quick_sort/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ <h1 id="_1">快速排序</h1>
238238
<p>合并结果</p>
239239
</li>
240240
</ul>
241+
<p><img alt="" src="../quick_sort.png" /></p>
241242
<p>根据这个想法我们可以快速写出快排的代码,简直就是在翻译上边的描述:</p>
242243
<pre><code class="py">def quicksort(array):
243244
if len(array) &lt; 2: # 递归出口,空数组或者只有一个元素的数组都是有序的
@@ -271,6 +272,7 @@ <h1 id="_1">快速排序</h1>
271272
</code></pre>
272273

273274
<p>能否实现只遍历一次数组就可以完成 partition 操作呢?实际上是可以的。我们设置首位俩个指针 left, right,两个指针不断向中间收拢。如果遇到 left 位置的元素大于 pivot 并且 right 指向的元素小于 pivot,我们就交换这俩元素,当 left &gt; right 的时候退出就行了,这样实现了一次遍历就完成了 partition。如果你感觉懵逼,纸上画画就立马明白了。我们来撸代码实现:</p>
275+
<p><img alt="" src="../partition.png" /></p>
274276
<pre><code class="py">def partition(array, beg, end):
275277
pivot_index = beg
276278
pivot = array[pivot_index]

index.html

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

482482
<!--
483483
MkDocs version : 0.17.3
484-
Build Date UTC : 2018-05-17 00:54:17
484+
Build Date UTC : 2018-05-19 08:15:42
485485
-->

search/search_index.json

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

sitemap.xml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,111 +4,111 @@
44

55
<url>
66
<loc>/</loc>
7-
<lastmod>2018-05-17</lastmod>
7+
<lastmod>2018-05-19</lastmod>
88
<changefreq>daily</changefreq>
99
</url>
1010

1111

1212

1313
<url>
1414
<loc>/00_课程简介之笨方法学算法/why_and_how_to_learn/</loc>
15-
<lastmod>2018-05-17</lastmod>
15+
<lastmod>2018-05-19</lastmod>
1616
<changefreq>daily</changefreq>
1717
</url>
1818

1919

2020

2121
<url>
2222
<loc>/01_抽象数据类型和面向对象编程/ADT_OOP/</loc>
23-
<lastmod>2018-05-17</lastmod>
23+
<lastmod>2018-05-19</lastmod>
2424
<changefreq>daily</changefreq>
2525
</url>
2626

2727

2828

2929
<url>
3030
<loc>/02_数组和列表/array_and_list/</loc>
31-
<lastmod>2018-05-17</lastmod>
31+
<lastmod>2018-05-19</lastmod>
3232
<changefreq>daily</changefreq>
3333
</url>
3434

3535

3636

3737
<url>
3838
<loc>/03_链表/linked_list/</loc>
39-
<lastmod>2018-05-17</lastmod>
39+
<lastmod>2018-05-19</lastmod>
4040
<changefreq>daily</changefreq>
4141
</url>
4242

4343

4444

4545
<url>
4646
<loc>/04_队列/queue/</loc>
47-
<lastmod>2018-05-17</lastmod>
47+
<lastmod>2018-05-19</lastmod>
4848
<changefreq>daily</changefreq>
4949
</url>
5050

5151

5252

5353
<url>
5454
<loc>/05_栈/stack/</loc>
55-
<lastmod>2018-05-17</lastmod>
55+
<lastmod>2018-05-19</lastmod>
5656
<changefreq>daily</changefreq>
5757
</url>
5858

5959

6060

6161
<url>
6262
<loc>/06_算法分析/big_o/</loc>
63-
<lastmod>2018-05-17</lastmod>
63+
<lastmod>2018-05-19</lastmod>
6464
<changefreq>daily</changefreq>
6565
</url>
6666

6767

6868

6969
<url>
7070
<loc>/07_哈希表/hashtable/</loc>
71-
<lastmod>2018-05-17</lastmod>
71+
<lastmod>2018-05-19</lastmod>
7272
<changefreq>daily</changefreq>
7373
</url>
7474

7575

7676

7777
<url>
7878
<loc>/08_字典/dict/</loc>
79-
<lastmod>2018-05-17</lastmod>
79+
<lastmod>2018-05-19</lastmod>
8080
<changefreq>daily</changefreq>
8181
</url>
8282

8383

8484

8585
<url>
8686
<loc>/09_集合/set/</loc>
87-
<lastmod>2018-05-17</lastmod>
87+
<lastmod>2018-05-19</lastmod>
8888
<changefreq>daily</changefreq>
8989
</url>
9090

9191

9292

9393
<url>
9494
<loc>/10_递归/recursion/</loc>
95-
<lastmod>2018-05-17</lastmod>
95+
<lastmod>2018-05-19</lastmod>
9696
<changefreq>daily</changefreq>
9797
</url>
9898

9999

100100

101101
<url>
102102
<loc>/11_线性查找与二分查找/search/</loc>
103-
<lastmod>2018-05-17</lastmod>
103+
<lastmod>2018-05-19</lastmod>
104104
<changefreq>daily</changefreq>
105105
</url>
106106

107107

108108

109109
<url>
110110
<loc>/12_基本排序算法/basic_sort/</loc>
111-
<lastmod>2018-05-17</lastmod>
111+
<lastmod>2018-05-19</lastmod>
112112
<changefreq>daily</changefreq>
113113
</url>
114114

@@ -117,19 +117,19 @@
117117

118118
<url>
119119
<loc>/13_高级排序算法/advanced_sorting/</loc>
120-
<lastmod>2018-05-17</lastmod>
120+
<lastmod>2018-05-19</lastmod>
121121
<changefreq>daily</changefreq>
122122
</url>
123123

124124
<url>
125125
<loc>/13_高级排序算法/merge_sort/</loc>
126-
<lastmod>2018-05-17</lastmod>
126+
<lastmod>2018-05-19</lastmod>
127127
<changefreq>daily</changefreq>
128128
</url>
129129

130130
<url>
131131
<loc>/13_高级排序算法/quick_sort/</loc>
132-
<lastmod>2018-05-17</lastmod>
132+
<lastmod>2018-05-19</lastmod>
133133
<changefreq>daily</changefreq>
134134
</url>
135135

@@ -138,55 +138,55 @@
138138

139139
<url>
140140
<loc>/14_树与二叉树/tree/</loc>
141-
<lastmod>2018-05-17</lastmod>
141+
<lastmod>2018-05-19</lastmod>
142142
<changefreq>daily</changefreq>
143143
</url>
144144

145145

146146

147147
<url>
148148
<loc>/15_堆与堆排序/heap_and_heapsort/</loc>
149-
<lastmod>2018-05-17</lastmod>
149+
<lastmod>2018-05-19</lastmod>
150150
<changefreq>daily</changefreq>
151151
</url>
152152

153153

154154

155155
<url>
156156
<loc>/16_优先级队列/priority_queue/</loc>
157-
<lastmod>2018-05-17</lastmod>
157+
<lastmod>2018-05-19</lastmod>
158158
<changefreq>daily</changefreq>
159159
</url>
160160

161161

162162

163163
<url>
164164
<loc>/17_二叉查找树/binary_search_tree/</loc>
165-
<lastmod>2018-05-17</lastmod>
165+
<lastmod>2018-05-19</lastmod>
166166
<changefreq>daily</changefreq>
167167
</url>
168168

169169

170170

171171
<url>
172172
<loc>/18_图与图的遍历/graph/</loc>
173-
<lastmod>2018-05-17</lastmod>
173+
<lastmod>2018-05-19</lastmod>
174174
<changefreq>daily</changefreq>
175175
</url>
176176

177177

178178

179179
<url>
180180
<loc>/19_python内置常用算法和数据结构/builtins/</loc>
181-
<lastmod>2018-05-17</lastmod>
181+
<lastmod>2018-05-19</lastmod>
182182
<changefreq>daily</changefreq>
183183
</url>
184184

185185

186186

187187
<url>
188188
<loc>/20_面试指南/interview/</loc>
189-
<lastmod>2018-05-17</lastmod>
189+
<lastmod>2018-05-19</lastmod>
190190
<changefreq>daily</changefreq>
191191
</url>
192192

0 commit comments

Comments
 (0)