Skip to content

Commit 2da4978

Browse files
committed
Deployed 3a2f4d8 with MkDocs version: 1.0.4
1 parent 1289c52 commit 2da4978

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

07_哈希表/hashtable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Slot(object):
3131
"""定义一个 hash 表 数组的槽
3232
注意,一个槽有三种状态,看你能否想明白。相比链接法解决冲突,二次探查法删除一个 key 的操作稍微复杂。
3333
1.从未使用 HashMap.UNUSED。此槽没有被使用和冲突过,查找时只要找到 UNUSED 就不用再继续探查了
34-
2.使用过但是 remove 了,此时是 HashMap.EMPTY,该探查点后边的元素扔可能是有key
34+
2.使用过但是 remove 了,此时是 HashMap.EMPTY,该探查点后边的元素仍然可能是有key的,需要继续查找
3535
3.槽正在使用 Slot 节点
3636
"""
3737

@@ -82,12 +82,12 @@ def _find_slot_for_insert(self, key):
8282
def _slot_can_insert(self, index):
8383
return (self._table[index] is HashTable.EMPTY or self._table[index] is HashTable.UNUSED)
8484

85-
def __contains__(self, key): # in operator
85+
def __contains__(self, key): # in operator,实现之后可以使用 in 操作符判断
8686
index = self._find_key(key)
8787
return index is not None
8888

8989
def add(self, key, value):
90-
if key in self:
90+
if key in self: # update
9191
index = self._find_key(key)
9292
self._table[index].value = value
9393
return False

07_哈希表/hashtable/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ <h1 id="_5">延伸阅读</h1>
391391
<li>《Data Structures and Algorithms in Python》11 章 Hash Tables</li>
392392
<li>《算法导论》第三版 11 章散列表,了解几种哈希冲突的解决方式,以及为什么我们选择二次探查而不是线性探查法?</li>
393393
<li>介绍 c 解释器如何实现的 python dict对象:<a href="http://www.laurentluce.com/posts/python-dictionary-implementation/">Python dictionary implementation</a></li>
394+
<li><a href="https://stackoverflow.com/questions/2070276/where-can-i-find-source-or-algorithm-of-pythons-hash-function">Python hash function implement</a></li>
394395
</ul>
395396

396397
</div>

index.html

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

588588
<!--
589589
MkDocs version : 1.0.4
590-
Build Date UTC : 2019-10-19 03:30:15
590+
Build Date UTC : 2019-10-20 03:09:16
591591
-->

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>2019-10-19</lastmod>
5+
<lastmod>2019-10-20</lastmod>
66
<changefreq>daily</changefreq>
77
</url>
88
<url>
99
<loc>None</loc>
10-
<lastmod>2019-10-19</lastmod>
10+
<lastmod>2019-10-20</lastmod>
1111
<changefreq>daily</changefreq>
1212
</url>
1313
<url>
1414
<loc>None</loc>
15-
<lastmod>2019-10-19</lastmod>
15+
<lastmod>2019-10-20</lastmod>
1616
<changefreq>daily</changefreq>
1717
</url>
1818
<url>
1919
<loc>None</loc>
20-
<lastmod>2019-10-19</lastmod>
20+
<lastmod>2019-10-20</lastmod>
2121
<changefreq>daily</changefreq>
2222
</url>
2323
<url>
2424
<loc>None</loc>
25-
<lastmod>2019-10-19</lastmod>
25+
<lastmod>2019-10-20</lastmod>
2626
<changefreq>daily</changefreq>
2727
</url>
2828
<url>
2929
<loc>None</loc>
30-
<lastmod>2019-10-19</lastmod>
30+
<lastmod>2019-10-20</lastmod>
3131
<changefreq>daily</changefreq>
3232
</url>
3333
<url>
3434
<loc>None</loc>
35-
<lastmod>2019-10-19</lastmod>
35+
<lastmod>2019-10-20</lastmod>
3636
<changefreq>daily</changefreq>
3737
</url>
3838
<url>
3939
<loc>None</loc>
40-
<lastmod>2019-10-19</lastmod>
40+
<lastmod>2019-10-20</lastmod>
4141
<changefreq>daily</changefreq>
4242
</url>
4343
<url>
4444
<loc>None</loc>
45-
<lastmod>2019-10-19</lastmod>
45+
<lastmod>2019-10-20</lastmod>
4646
<changefreq>daily</changefreq>
4747
</url>
4848
<url>
4949
<loc>None</loc>
50-
<lastmod>2019-10-19</lastmod>
50+
<lastmod>2019-10-20</lastmod>
5151
<changefreq>daily</changefreq>
5252
</url>
5353
<url>
5454
<loc>None</loc>
55-
<lastmod>2019-10-19</lastmod>
55+
<lastmod>2019-10-20</lastmod>
5656
<changefreq>daily</changefreq>
5757
</url>
5858
<url>
5959
<loc>None</loc>
60-
<lastmod>2019-10-19</lastmod>
60+
<lastmod>2019-10-20</lastmod>
6161
<changefreq>daily</changefreq>
6262
</url>
6363
<url>
6464
<loc>None</loc>
65-
<lastmod>2019-10-19</lastmod>
65+
<lastmod>2019-10-20</lastmod>
6666
<changefreq>daily</changefreq>
6767
</url>
6868
<url>
6969
<loc>None</loc>
70-
<lastmod>2019-10-19</lastmod>
70+
<lastmod>2019-10-20</lastmod>
7171
<changefreq>daily</changefreq>
7272
</url>
7373
<url>
7474
<loc>None</loc>
75-
<lastmod>2019-10-19</lastmod>
75+
<lastmod>2019-10-20</lastmod>
7676
<changefreq>daily</changefreq>
7777
</url>
7878
<url>
7979
<loc>None</loc>
80-
<lastmod>2019-10-19</lastmod>
80+
<lastmod>2019-10-20</lastmod>
8181
<changefreq>daily</changefreq>
8282
</url>
8383
<url>
8484
<loc>None</loc>
85-
<lastmod>2019-10-19</lastmod>
85+
<lastmod>2019-10-20</lastmod>
8686
<changefreq>daily</changefreq>
8787
</url>
8888
<url>
8989
<loc>None</loc>
90-
<lastmod>2019-10-19</lastmod>
90+
<lastmod>2019-10-20</lastmod>
9191
<changefreq>daily</changefreq>
9292
</url>
9393
<url>
9494
<loc>None</loc>
95-
<lastmod>2019-10-19</lastmod>
95+
<lastmod>2019-10-20</lastmod>
9696
<changefreq>daily</changefreq>
9797
</url>
9898
<url>
9999
<loc>None</loc>
100-
<lastmod>2019-10-19</lastmod>
100+
<lastmod>2019-10-20</lastmod>
101101
<changefreq>daily</changefreq>
102102
</url>
103103
<url>
104104
<loc>None</loc>
105-
<lastmod>2019-10-19</lastmod>
105+
<lastmod>2019-10-20</lastmod>
106106
<changefreq>daily</changefreq>
107107
</url>
108108
<url>
109109
<loc>None</loc>
110-
<lastmod>2019-10-19</lastmod>
110+
<lastmod>2019-10-20</lastmod>
111111
<changefreq>daily</changefreq>
112112
</url>
113113
<url>
114114
<loc>None</loc>
115-
<lastmod>2019-10-19</lastmod>
115+
<lastmod>2019-10-20</lastmod>
116116
<changefreq>daily</changefreq>
117117
</url>
118118
<url>
119119
<loc>None</loc>
120-
<lastmod>2019-10-19</lastmod>
120+
<lastmod>2019-10-20</lastmod>
121121
<changefreq>daily</changefreq>
122122
</url>
123123
</urlset>

sitemap.xml.gz

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)