Skip to content

Commit ce94155

Browse files
committed
Deployed 86a4d42 with MkDocs version: 0.17.3
1 parent 7f7c487 commit ce94155

File tree

7 files changed

+47
-40
lines changed

7 files changed

+47
-40
lines changed

07_哈希表/hashtable/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ <h1 id="hashtable-adt">HashTable ADT</h1>
382382
<p>具体的实现和代码编写在视频里讲解。这个代码可不太好实现,稍不留神就会有错,我们还是通过编写单元测试验证代码的正确性。</p>
383383
<h1 id="_4">思考题</h1>
384384
<ul>
385+
<li>请你分析下哈希表插入和删除元素的平均时间复杂度是多少?我们都实现代码了,相信这个问题你可以回答上来</li>
385386
<li>Slot 在二次探查法里为什么不能直接删除?为什么我们要给它定义几个状态?</li>
386387
</ul>
387388
<h1 id="_5">延伸阅读</h1>
-428 Bytes
Binary file not shown.

08_字典/dict/index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ <h1 id="dict-adt">实现 dict ADT</h1>
240240
pass
241241
</code></pre>
242242

243-
<p>视频里我们将演示如何实现这些方法,并且写单侧验证正确性</p>
243+
<p>视频里我们将演示如何实现这些方法,并且写单测验证正确性</p>
244244
<h1 id="hashable">Hashable</h1>
245245
<p>作为 dict 的 key 必须是可哈希的,也就是说不能是 list 等可变对象。不信你在 ipython 里运行如下代码:</p>
246246
<pre><code class="py">d = dict()
@@ -249,11 +249,13 @@ <h1 id="hashable">Hashable</h1>
249249
</code></pre>
250250

251251
<p>我引用 python 文档里的说法,大家可以自己理解下:</p>
252-
<blockquote>
253-
<p>An object is hashable if it has a hash value which never changes during its lifetime (it needs a <strong>hash</strong>() method), and can be compared to other objects (it needs an <strong>eq</strong>() or <strong>cmp</strong>() method). Hashable objects which compare equal must have the same hash value.</p>
254-
<p>Hashability makes an object usable as a dictionary key and a set member, because these data structures use the hash value internally.</p>
255-
<p>All of Python’s immutable built-in objects are hashable, while no mutable containers (such as lists or dictionaries) are. Objects which are instances of user-defined classes are hashable by default; they all compare unequal (except with themselves), and their hash value is derived from their id().</p>
256-
</blockquote>
252+
<pre><code>An object is hashable if it has a hash value which never changes during its lifetime (it needs a __hash__() method), and can be compared to other objects (it needs an __eq__() or __cmp__() method). Hashable objects which compare equal must have the same hash value.
253+
254+
Hashability makes an object usable as a dictionary key and a set member, because these data structures use the hash value internally.
255+
256+
All of Python’s immutable built-in objects are hashable, while no mutable containers (such as lists or dictionaries) are. Objects which are instances of user-defined classes are hashable by default; they all compare unequal (except with themselves), and their hash value is derived from their id().
257+
</code></pre>
258+
257259
<h1 id="_1">思考题:</h1>
258260
<ul>
259261
<li>你能在哈希表的基础上实现 dict 的其他操作吗?</li>

09_集合/set/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@
225225
<div class="section">
226226

227227
<h1 id="set">集合 set</h1>
228-
<p>这一章讲集合,实际上它的底层也是哈希表实现的,所以像实现 DictADT 一样,借助 HashTable 实现它也比较简单。</p>
228+
<p>集合是一种不包含重复元素的数据结构,经常用来判断是否重复这种操作,或者集合中是否存在一个元素。
229+
这一章讲集合,实际上它的底层也是哈希表实现的,所以像实现 DictADT 一样,借助 HashTable 实现它也比较简单。</p>
229230
<h1 id="_1">集合操作</h1>
230231
<p>集合可能最常用的就是去重,判断是否存在一个元素等,但是 set 相比 dict 有更丰富的操作,主要是数学概念上的。
231232
如果你学过《离散数学》中集合相关的概念,基本上是一致的。 python 的 set 提供了如下基本的集合操作,
@@ -255,6 +256,9 @@ <h1 id="set-adt">实现一个 set ADT</h1>
255256
<p>当然其它数学上的操作就麻烦点了,不过也很容易实现。</p>
256257
<h1 id="_2">思考题</h1>
257258
<ul>
259+
<li>集合判断一个元素是否存在的时间复杂度是多少?</li>
260+
<li>集合的元素 key 需要满足什么概念?可变对象可以吗?</li>
261+
<li>请你在 SetADT 基础上实现集合的 remove 操作和 pop 操作</li>
258262
<li>你能尝试实现对称差操作吗?这里我没有实现,留给你作为练习</li>
259263
<li>你知道如何重载 python 的内置运算符吗?这里我们实现 set 的集合操作就是用到了重载,请阅读相关 python 文档。</li>
260264
</ul>

index.html

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

481481
<!--
482482
MkDocs version : 0.17.3
483-
Build Date UTC : 2018-05-11 13:51:07
483+
Build Date UTC : 2018-05-12 10:16:19
484484
-->

search/search_index.json

Lines changed: 8 additions & 8 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-11</lastmod>
7+
<lastmod>2018-05-12</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-11</lastmod>
15+
<lastmod>2018-05-12</lastmod>
1616
<changefreq>daily</changefreq>
1717
</url>
1818

1919

2020

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

2727

2828

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

3535

3636

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

4343

4444

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

5151

5252

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

5959

6060

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

6767

6868

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

7575

7676

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

8383

8484

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

9191

9292

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

9999

100100

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

107107

108108

109109
<url>
110110
<loc>/12_基本排序算法/basic_sort/</loc>
111-
<lastmod>2018-05-11</lastmod>
111+
<lastmod>2018-05-12</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-11</lastmod>
120+
<lastmod>2018-05-12</lastmod>
121121
<changefreq>daily</changefreq>
122122
</url>
123123

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

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

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

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

145145

146146

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

153153

154154

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

161161

162162

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

169169

170170

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

177177

178178

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

185185

186186

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

0 commit comments

Comments
 (0)