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

A problem about node split #3

Open
phac123 opened this issue May 17, 2022 · 1 comment
Open

A problem about node split #3

phac123 opened this issue May 17, 2022 · 1 comment

Comments

@phac123
Copy link

phac123 commented May 17, 2022

In the file 'B-Tree.py'.
There are some code problem.
Details are as follows.
In function '_splitChild(self, x, i)',

t = self.t
        y = x.children[i]
        z = Node(y.leaf)
        x.children.insert(i + 1, z)
        x.keys.insert(i, y.keys[t - 1])
        z.keys = y.keys[t: (2 * t) - 1]
        y.keys = y.keys[0: t - 1]
        if not y.leaf:
            z.children = y.children[t: 2 * t]
            y.children = y.children[0: t - 1]

In my view, the correct version is:
z.keys = y.keys[t:(2t)-1]; y.keys = y.keys[0:t-2]
z.children=y.children[t:2
t];y.children=y.children[0:t-1]

@Ashwin-op
Copy link
Owner

@phac123 I fixed some stuff in B-Tree, do test it out and let me know if you still get the error.

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