Addendum for B+ Tree Pseudocode
I found one issue with the B+ tree pseudocode when implementing the assignment in Java that might prevent you from passing the final two test cases.
Line 11 of the “Pseudocode for deletion from a B+ tree” reads as follows:
\(N'\) <- the previous or next child of parent(\(N\))
To pass the final few tests, you must choose the previous child (if one exists) and the next child otherwise. Though not a matter of correctness for the B+ tree, the structure of the B+ tree will not match the expected structure, which will cause the test case to fail.
In my Java implementation, I did the following to match the expected behavior:
int index = node.parent.getChildren().indexOf(node);
int siblingIndex = 0 < index ? index - 1 : index + 1;
Node sibling = parent.getChildren().get(siblingIndex)
or, if you prefer Python,
index = node.parent.children.index(node)
sibling = node.parent.children[index - 1
if 0 < index else index + 1]
Of course, there are other ways of matching the expected behavior – just make sure that you always choose the previous child unless no previous child exists!