mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-04 06:07:20 +08:00 
			
		
		
		
	Add new label.
This commit is contained in:
		@ -12,7 +12,7 @@
 | 
			
		||||
 | 
			
		||||
该方法只适用于 $k \ll n$ 的情况,因为当 $k$ 与 $n$ 比较接近时,其时间复杂度趋向于 $O(n^2)$ ,非常耗时。
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
!!! tip
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@
 | 
			
		||||
 | 
			
		||||
显然,该方法“超额”完成任务了,因为我们只需要找出最大的 $k$ 个元素即可,而不需要排序其他元素。
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
## 方法三:堆
 | 
			
		||||
 | 
			
		||||
@ -36,7 +36,7 @@
 | 
			
		||||
4. 遍历完成后,堆中保存的就是最大的 $k$ 个元素;
 | 
			
		||||
 | 
			
		||||
=== "<1>"
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
=== "<2>"
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -176,7 +176,7 @@ nav:
 | 
			
		||||
    - chapter_heap/index.md
 | 
			
		||||
    - 8.1.   堆: chapter_heap/heap.md
 | 
			
		||||
    - 8.2.   建堆操作: chapter_heap/build_heap.md
 | 
			
		||||
    - 8.3.   Top-K 问题: chapter_heap/top_k.md
 | 
			
		||||
    - 8.3.   Top-K 问题(New): chapter_heap/top_k.md
 | 
			
		||||
    - 8.4.   小结: chapter_heap/summary.md
 | 
			
		||||
  - 9.     图:
 | 
			
		||||
    - chapter_graph/index.md
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user