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

I have a question for you!Can you help me? #12

Closed
juzzia opened this issue Aug 13, 2022 · 1 comment
Closed

I have a question for you!Can you help me? #12

juzzia opened this issue Aug 13, 2022 · 1 comment

Comments

@juzzia
Copy link

juzzia commented Aug 13, 2022

Hello, have a great weekend! at 1590 lines of code
the ds.bplus.bptreehandleLeafNodeRedistributionOrMerging.BPlusTree#handleLeafNodeRedistributionOrMerging method,I don't quite understand this condition,
code:

int snum = canRedistribute(splitNode);
if (snum > 0) {
  code of redistributing next node with elements from split
}

method canRedistribute is to determine whether a node will still be greater than or equal to M / 2-1 after removing a Key. However, the condition for entering the current method is that the number of keys of the node must be less than or equal to M / 2-1,So I don't think this greater than 0 condition is going to hold, What do you think?I am looking forward to your reply! (^_^)


Because my English is not very good,So the above English is translated by me using software,please forgive me if I have incorrect grammar or offended you! 😀

@andylamp
Copy link
Owner

Hi, not sure I follow... canRedistribute returns a count not a boolean, so this will hold in some instances and as required. If you want to find one such instance during execution either put a breakpoint in your IDE at that branch and observe during execution or uncomment the stdout prints there are in the code.

I do not have time to provide detailed implementation details, so you'll have to figure those out yourself. Unless of course there is a bug... if so, feel free to re-open the issue.

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

2 participants