Skip to content

Time Complexity Problem #3

Open
@SimonXiangD

Description

@SimonXiangD

Bro, thank you for your code. But your way of using heap will lead to $n^2logn$ time rather than nlogn, since you are using buildHeap in every iteration, and it is nlogn. The right method is to use heap with lazy delete to achieve O(nlogn) complexity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions