mirror of
https://github.com/krahets/hello-algo.git
synced 2026-09-02 05:07:13 +00:00
build
This commit is contained in:
@@ -12,7 +12,7 @@ comments: true
|
||||
|
||||
## 8.3.1 方法一:遍历选择
|
||||
|
||||
我们可以进行图 8-6 所示的 $k$ 轮遍历,分别在每轮中提取第 $1$ , $2$ , $\dots$ , $k$ 大的元素,时间复杂度为 $O(nk)$ 。
|
||||
我们可以进行图 8-6 所示的 $k$ 轮遍历,分别在每轮中提取第 $1$、$2$、$\dots$、$k$ 大的元素,时间复杂度为 $O(nk)$ 。
|
||||
|
||||
此方法只适用于 $k \ll n$ 的情况,因为当 $k$ 与 $n$ 比较接近时,其时间复杂度趋向于 $O(n^2)$ ,非常耗时。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user