Skip to content

fix bug: Incorrect size calculation in the Put function of the binary heap.#289

Open
MorePeanuts wants to merge 1 commit into
emirpasic:masterfrom
MorePeanuts:fix/binaryheap
Open

fix bug: Incorrect size calculation in the Put function of the binary heap.#289
MorePeanuts wants to merge 1 commit into
emirpasic:masterfrom
MorePeanuts:fix/binaryheap

Conversation

@MorePeanuts
Copy link
Copy Markdown

Fix binary heap construction in bulk Push

  • Fix incorrect starting index for heapify (changed from size/2 + 1 to size/2 - 1)
  • Remove redundant loop iteration by starting at the correct last non-leaf node
  • Aligns with standard binary heap construction algorithm (Floyd's algorithm)

@sonarqubecloud
Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

1 participant