Skip to content
New issue

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

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

Already on GitHub? # to your account

Heapify up when deleting node (possibly needed if the last element is larger) #1

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

glacialcascade
Copy link
Contributor

@glacialcascade glacialcascade commented Oct 3, 2024

With Max Heap selected, run b 8 7 3 5 6 2 1 4 and d 2. The resulting tree does not satisfy the max-heap property since 3 is now the parent of 4.

This PR fixes it by running animMaxHeapifyUp in the animMaxHeapDelete subroutine.

@glacialcascade glacialcascade changed the title heapify up when deleting node (possibly needed if the last element is larger) Heapify up when deleting node (possibly needed if the last element is larger) Oct 3, 2024
@edemaine edemaine merged commit 35e1fef into edemaine:main Oct 3, 2024
@edemaine
Copy link
Owner

edemaine commented Oct 3, 2024

Good catch, thanks!

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

Successfully merging this pull request may close these issues.

2 participants