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

Some irrelevant questions #38

Open
Chenyuanyuan299 opened this issue Apr 20, 2024 · 0 comments
Open

Some irrelevant questions #38

Chenyuanyuan299 opened this issue Apr 20, 2024 · 0 comments

Comments

@Chenyuanyuan299
Copy link

Hi, I'm learning how to implement heaps. Your heap implementation is very well written, but can you tell me in the extractRoot(), if the pop root == _leaf, _leaf will be the last node in _nodes, can it be directly assigned to null? What scenarios need to be assigned as this.root()?
next question, sort() will return a list in reverse order, and it mutates the node positions in the heap. This can be prevented in the code, can you tell me what you think?
Although it is a minor issue, I look forward to your reply, I would appreciate it. And I will provide a pr if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant