Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
B Tree | Trees Part II
Data Structure & Algorithms PART I
course content

Course Content

Data Structure & Algorithms PART I

Data Structure & Algorithms PART I

1. Introduction to ADS
2. Data Structures Part I
3. Trees Part I
4. Trees Part II

bookB Tree

OperationBest Time ComplexityAverage Time ComplexityWorst Time ComplexityMemory Complexity
SearchO(log n)O(log n)O(log n)O(n)
InsertionO(log n)O(log n)O(log n)O(n)
DeletionO(log n)O(log n)O(log n)O(n)

Let’s talk briefly about the first non-binary tree - B-tree.

When building a B-tree, a factor t is used, which is called the minimum degree. The value of t depends upon disk block size. Each node except the root must have at least t - 1 and no more than 2t - 1 keys. n[x] - the number of keys in node x.

The keys in a node are stored in non-decreasing order. If x is not a leaf, then it has n[x] + 1 children. The keys of a node define a range for the keys of their children.

All leaves of a B-tree must be located at the same height, which is the height of the tree.

We can perform the same operations with the B-tree as we performed with BST: searching, insertion, deletion.

B-trees are also balanced trees, so the time to perform standard operations in them is proportional to the height. But, unlike other trees, they are designed specifically to work efficiently with disk memory, or rather, they minimize I / O type calls.

There are some more B-tree type trees:

  • B* tree
  • B⁺ tree

They differ a little bit but in general they have the same structure.

You can study them on your own.

That’s all for now!

Let’s take a quiz!

An example of the B-tree with t = 3

B* tree and	B⁺ differ a lot from the B tree.

B* tree and B⁺ differ a lot from the B tree.

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 2
some-alt