docs: clarify kth largest complexity - #2901
Closed
Snailclimb wants to merge 1 commit into
Closed
Conversation
Owner
Author
|
按当前维护安排,改动改为本地统一整理,不通过独立 PR 提交,因此关闭此 Draft PR。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改内容
O(nlogk)、空间复杂度为O(k)O(n),以及 BFPRT 的最坏O(n)保证原因
原文把维护大小为 K 的小顶堆作为“求第 K 大”的常见方案,但没有说明该方案不满足 LeetCode 215 的
O(n)时间复杂度要求,容易让读者把通用 Top K 解法与特定题目的复杂度约束混淆。验证
pnpm exec prettier --check docs/cs-basics/data-structure/heap.mdpnpm exec markdownlint-cli2 docs/cs-basics/data-structure/heap.mdgit diff --checkCloses #2899