Skip to content

Commit b136e92

Browse files
authored
docs: update a description of the solution to lc problem: No.0215 (doocs#785)
No.0215.Kth Largest Element in an Array
1 parent 97de305 commit b136e92

File tree

1 file changed

+9
-1
lines changed
  • solution/0200-0299/0215.Kth Largest Element in an Array

1 file changed

+9
-1
lines changed

solution/0200-0299/0215.Kth Largest Element in an Array/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@
3838

3939
<!-- 这里可写通用的实现逻辑 -->
4040

41-
快速排序 partition 实现。
41+
一种简易的解法,将数组排序之后,即可轻易得知结果,复杂度由排序算法决定。
42+
43+
优化:
44+
45+
并不是所有时候,都需要整个数组进入有序状态,只需要**局部有序**,或者说,从大到小排序,只要 `[0..k)` 位置的元素有序,那么就能确定结果,此处使用**快速排序**
46+
47+
快速排序有一特点,每一次循环结束时,能够确定的是:`partition` 一定处于它该处于的索引位置。从而根据它得知,结果值是在左数组还是在右数组当中,然后对那一数组进行排序即可。
48+
49+
> `partition` 便是快速排序中选择的比较样本。
4250
4351
<!-- tabs:start -->
4452

0 commit comments

Comments
 (0)