Skip to content

Commit 66f244b

Browse files
committed
Deployed 0c51b9a with MkDocs version: 0.17.3
1 parent 387c6ed commit 66f244b

21 files changed

+600
-588
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

03_链表/linked_list.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def remove(self, value): # O(n)
7474
del curnode
7575
self.length -= 1
7676
return 1 # 表明删除成功
77+
else:
78+
prevnode = curnode
7779
return -1 # 表明删除失败
7880

7981
def find(self, value): # O(n)
@@ -113,26 +115,27 @@ def test_linked_list():
113115
ll.append(0)
114116
ll.append(1)
115117
ll.append(2)
118+
ll.append(3)
116119

117-
assert len(ll) == 3
120+
assert len(ll) == 4
118121
assert ll.find(2) == 2
119-
assert ll.find(3) == -1
122+
assert ll.find(-1) == -1
120123

121124
assert ll.remove(0) == 1
122-
assert ll.remove(3) == -1
125+
assert ll.remove(10) == -1
126+
assert ll.remove(2) == 1
123127
assert len(ll) == 2
128+
assert list(ll) == [1, 3]
124129
assert ll.find(0) == -1
125130

126-
assert list(ll) == [1, 2]
127-
128131
ll.appendleft(0)
129-
assert list(ll) == [0, 1, 2]
132+
assert list(ll) == [0, 1, 3]
130133
assert len(ll) == 3
131134

132135
headvalue = ll.popleft()
133136
assert headvalue == 0
134137
assert len(ll) == 2
135-
assert list(ll) == [1, 2]
138+
assert list(ll) == [1, 3]
136139

137140
ll.clear()
138141
assert len(ll) == 0

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.

04_队列/queue.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@ def remove(self, value): # O(n)
6969
"""
7070
prevnode = self.root #
7171
curnode = self.root.next
72-
while curnode.next is not None:
72+
for curnode in self.iter_node():
7373
if curnode.value == value:
7474
prevnode.next = curnode.next
7575
del curnode
7676
self.length -= 1
77-
return
77+
return 1 # 表明删除成功
78+
else:
79+
prevnode = curnode
80+
return -1 # 表明删除失败
7881

7982
def find(self, value): # O(n)
8083
""" 查找一个节点,返回序号,从 0 开始
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: 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-31 11:06:57
483+
Build Date UTC : 2018-06-01 00:18:36
484484
-->

search/search_index.json

Lines changed: 554 additions & 554 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-31</lastmod>
7+
<lastmod>2018-06-01</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-31</lastmod>
15+
<lastmod>2018-06-01</lastmod>
1616
<changefreq>daily</changefreq>
1717
</url>
1818

1919

2020

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

2727

2828

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

3535

3636

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

4343

4444

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

5151

5252

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

5959

6060

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

6767

6868

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

7575

7676

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

8383

8484

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

9191

9292

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

9999

100100

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

107107

108108

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

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

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

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

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

145145

146146

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

153153

154154

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

161161

162162

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

169169

170170

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

177177

178178

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

185185

186186

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

0 commit comments

Comments
 (0)