Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 0347.前K个高频元素.md #2542

Merged
merged 2 commits into from
May 22, 2024

Commits on Apr 26, 2024

  1. Configuration menu
    Copy the full SHA
    1c390b3 View commit details
    Browse the repository at this point in the history
  2. Update 0347.前K个高频元素.md

    1. 修复了 JavaScript 解法二,堆 pop 方法无法处理数组长度 <= 1 的边界情况的问题
    2. 删除了有误导性的条件判断。事实上,被删除的表达式永远为真(searchChild !== undefined)。原作者想表达的意思可能是 this.queue[searchChild] !== undefined,而实际上,这个判断也是不必要的,这种情况会被后续的 this.compare(index, searchChild) > 0 判断排除。但鉴于本项目的教程性质,直接去除可能会导致语义不清,考虑酌情将原处替换为 this.queue[searchChild] !== undefined 或直接删除
    xqsrpanz committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    bcdf3e4 View commit details
    Browse the repository at this point in the history