Here is a link to a full trace of Kruse's B Tree delete function (for e.g. covered in class:
Here is a link to a full trace of Kruse's B Tree insert function (for e.g. covered in class:
For 151 - Summary Notes on B* trees:
For Inserts- The idea is to delay splits until right sibling and your node are both full. For root nodes on an order 9 tree, full is when the root has 10 data values, for non-roots, full is when the node has 8 data elements. Root splits are 1 into 2 node splits, all other splits are 2 to 3 node splits. Since you are delaying splits, you may need to use move_right or move_left, and you may need these at levels in the tree HIGHER than the leaf level.
For Deletes - The idea is to delay combines here. Combines at the level just below and including the root will be a 2 nodes combine into 1 combine. Levels below this will be a 3 nodes combine into 2 combine. If the node that is now below the minimum has a sibling on both the right and left, these are the nodes to combine with. If either of these nodes has "room to borrow" from, then use move_right or move_left to delay the combine as long as possible. If you are at a leftmost sibling, then use the 2 nodes immediately to the right to borrow from or combine with. If you are at the rightmost sibling, then use the 2 nodes immediately to the left. Combines of 3 nodes to 2 will always involve 3 nodes that have all fallen to the level of having only 5 data values and a new delete has caused one of these to fall to only 4. Combines of 2 nodes into 1 (root combines) will involve 2 sibling nodes (and they are their only siblings) that have fallen to 5 data values each and the new delete has caused one of the nodes to fall to 4 values.
Here is a link to appropriate node definitions to accommodate generic (base class) nodes and root nodes versus non-root nodes in your B* Trees: Please note! I have removed the node.cpp file from this directory since it was an empty file and simply not needed!
Here is a link to some non-recursive code that generates B tree indexes: (Note - this code actually works by creating the nodes as chunks of data out on disk in a datafile. In this way it is more like a real B tree. However, you are not creating nodes in a datafile for this assignment. Learn what you can from this code, use it as a tool, although I will not go over it and how it works in detail.)