0% found this document useful (0 votes)
15 views10 pages

11 B+tree

B+ trees store data only in leaf nodes, with internal nodes containing keys and pointers to child nodes. This allows B+ trees to perform searches more efficiently by requiring access to only one child during searches. B+ trees also link leaf nodes together using a doubly-linked list, allowing sequential access to all records.

Uploaded by

iffy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views10 pages

11 B+tree

B+ trees store data only in leaf nodes, with internal nodes containing keys and pointers to child nodes. This allows B+ trees to perform searches more efficiently by requiring access to only one child during searches. B+ trees also link leaf nodes together using a doubly-linked list, allowing sequential access to all records.

Uploaded by

iffy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

B+ tree

B+ tree eliminates the drawback B-tree used for indexing by


storing data pointers only at the leaf nodes of the tree. Thus,
the structure of leaf nodes of a B+ tree is quite different from
the structure of internal nodes of the B tree. It may be noted
here that, since data pointers are present only at the leaf nodes,
the leaf nodes must necessarily store all the key values along
with their corresponding data pointers to the disk file block, in
order to access them.

B+tree
B+tree
A B+ tree is the same as a B tree;
the only difference is that:
• All leaf nodes are linked together
in a doubly-linked list
• Satellite data is stored on the leaf
nodes only. Internal nodes only
hold keys and act as routers to the
correct leaf node
Notice that some keys seem to be duplicated, like 2, 4, and 5.
This is because, unlike leaf nodes, the internal nodes of a
B+tree B+tree cannot hold satellite data and so we must make sure in
some way that the leaf nodes include all the keys/value pairs.
Tree of degree 3

To start with, we’ll insert Keys 1 and 2 into the root node in ascending order:
Insert 3

When we come to insert Key 3, we


find that in doing so we will exceed
the capacity of the root node.

Similar to a normal B-tree this means


we need to perform a split operation.
However, unlike with the B-tree, we
must copy-up the first key in the new
rightmost leaf node. As mentioned,
this is so we can make sure we have a
key/value pair for Key 2 in the leaf
nodes:
Insert 4

Next, we add Key 4 to the


rightmost leaf node.
Since it’s full, we need to
perform another a split
operation and copy-up
Key 3 to the root node:
Insert 5

Now, let’s add 5 to the


rightmost leaf node. Once again
to keep the order, we’ll split the
leaf node and copy-up 4. Since
Notice the difference between splitting a leaf node and splitting
that will overflow the root node,
an internal node. When we split the internal node in the second
we’ll have to perform another split operation we didn’t copy-up Key 3.
split operation splitting the root
node into two nodes and
promoting 3 into a new root
node:
In the same way, we keep adding the keys from 6 to
10, each time splitting and copying-up when
necessary until we have reached our final tree:
Take home
Compare and contrast a B-tree and B+ tree;
advantages and disadvantages over each other

You might also like