-
Notifications
You must be signed in to change notification settings - Fork 45.5k
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
reduce the number of swaps when comparing in minHeap #25125
Conversation
Can you explain what you mean by "reduce the number of swaps?" In both implementations there's at most a single swap per |
} | ||
} | ||
heap[index] = node; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part makes sense
} | ||
} | ||
heap[index] = node; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, so you're waiting to assign the final index until the end. The other factoring changes in this function don't seem relevant, though? Just stylistic. Do you mind reverting those?
576159f
to
f29f442
Compare
f29f442
to
b7cc377
Compare
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you! |
use once assignment, instead of swap when comparing in SchedulerMinHeap