Skip to content

Commit 752761a

Browse files
committed
Deployed c8af01f with MkDocs version: 1.0.4
1 parent 98cf9aa commit 752761a

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

15_堆与堆排序/heap_and_heapsort/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
<li class="toctree-l2"><a href="#_5">实现堆排序</a></li>
166166

167167

168-
<li class="toctree-l2"><a href="#python-heapq">python 里的 heapq</a></li>
168+
<li class="toctree-l2"><a href="#python-heapq">Python 里的 heapq 模块</a></li>
169169

170170

171171
<li class="toctree-l2"><a href="#top-k">Top K 问题</a></li>
@@ -351,7 +351,7 @@ <h1 id="_5">实现堆排序</h1>
351351
assert heapsort_reverse(l) == sorted(l, reverse=True)
352352
</code></pre>
353353

354-
<h1 id="python-heapq">python 里的 heapq</h1>
354+
<h1 id="python-heapq">Python 里的 heapq 模块</h1>
355355
<p>python 其实自带了 heapq 模块,用来实现堆的相关操作,原理是类似的。请你阅读相关文档并使用内置的 heapq 模块完成堆排序。
356356
一般我们刷题或者写业务代码的时候,使用这个内置的 heapq 模块就够用了。</p>
357357
<h1 id="top-k">Top K 问题</h1>
@@ -394,7 +394,7 @@ <h1 id="top-k">Top K 问题</h1>
394394

395395
def test():
396396
import random
397-
i = list(range(1000))
397+
i = list(range(1000)) # 这里可以是一个可迭代元素,节省内存
398398
random.shuffle(i)
399399
_ = TopK(i, 10)
400400
print(_.get_topk())
@@ -410,6 +410,7 @@ <h1 id="_6">练习题</h1>
410410
<li>请你实现一个最小堆,你需要修改那些代码呢?</li>
411411
<li>我们实现的堆排序是 inplace 的吗,如果不是,你能改成 inplace 的吗?</li>
412412
<li>堆排序的时间复杂度是多少? siftup 和 siftdown 的时间复杂度是多少?(小提示:考虑树的高度,它决定了操作次数)</li>
413+
<li>请你思考 Top K 问题的时间复杂度是多少?</li>
413414
</ul>
414415
<h1 id="_7">延伸阅读</h1>
415416
<ul>

index.html

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

582582
<!--
583583
MkDocs version : 1.0.4
584-
Build Date UTC : 2018-12-23 02:56:52
584+
Build Date UTC : 2018-12-23 03:03:35
585585
-->

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

sitemap.xml.gz

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)