0% found this document useful (0 votes)
11 views65 pages

Chapter 7 A

B-Trees are balanced search trees optimized for disk storage, minimizing disk I/O operations and enhancing database indexing. They maintain a low height by storing multiple keys per node, which reduces the number of disk accesses required for operations like search, insert, and delete. B-Trees are particularly useful for managing large datasets that exceed main memory capacity.

Uploaded by

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

Chapter 7 A

B-Trees are balanced search trees optimized for disk storage, minimizing disk I/O operations and enhancing database indexing. They maintain a low height by storing multiple keys per node, which reduces the number of disk accesses required for operations like search, insert, and delete. B-Trees are particularly useful for managing large datasets that exceed main memory capacity.

Uploaded by

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

DESIGN & ANALYSIS OF ALGORITHM

(BCSC0012)

Chapter 7: B-Trees

Prof. Anand Singh J a l a l


Department of Computer Engineering & Applications
B-Trees
B-trees are balanced search trees designed to work well on disks or other
direct access secondary storage devices.
B-Trees are better at minimizing disks I/O operations.
Database systems use B-Trees and its variants for indexing.

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
Source: Figure 2-3 https://dzone.com/articles/database-btree-indexing-in-sqlite
B-Trees
• B-Tree is a self-balancing search tree. In most of the other self-balancing search trees (like
AVL and Red-Black Trees), it is assumed that everything is in the main memory.
• To understand the use of B-Trees, we must think of the huge amount of data that cannot
fit in the main memory. When the number of keys is high, the data is read from the disk in
the form of blocks. Disk access time is very high compared to the main memory access
time. The main idea of using B-Trees is to reduce the number of disk accesses.
• Most of the tree operations (search, insert, delete, max, min, ..etc ) require O(h) disk
accesses where h is the height of the tree. B-tree is a fat tree. The height of B-Trees is kept
low by putting the maximum possible keys in a B-Tree node.
• Generally, the B-Tree node size is kept equal to the disk block size. Since the height of
the B-tree is low so total disk accesses for most of the operations are reduced significantly
compared to balanced Binary Search Trees like AVL Tree, Red-Black Tree, etc.
Why use B-Tree
• Reduces the number of reads made on the disk
• B Trees can be easily optimized to adjust its size (that is the number of child
nodes) according to the disk size
• It is a specially designed technique for handling a bulky amount of data.
• It is a useful algorithm for databases and file systems.
• A good choice to opt when it comes to reading and writing large blocks of
data

https://www.guru99.com/b-tree-example.html
B-Tree
A B-tree T is a rooted tree (whose root is T.root) having following properties:
1. Every node x has the following attributes:
1 2 … n
a. x.n, the number of keys currently stored in node x,
b. the x.n keys themselves, x.key1, x.key2,….,x.keyn, stored n=3, keys 5,1,3
in non-decreasing, so that x.key1<=x.key2<=…<=x.keyn, 5

c. x.leaf, a Boolean value that is true if x is a leaf and false if


x is an internal node.

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees
A B-tree T is a rooted tree (whose root is T.root) having following properties:
1. Every node x has the following attributes:
1 2 … n
a. x.n, the number of keys currently stored in node x,
b. the x.n keys themselves, x.key1, x.key2,….,x.keyn, stored n=3, keys 5,1,3
in non-decreasing, so that x.key1<=x.key2<=…<=x.keyn, 1 5

c. x.leaf, a Boolean value that is true if x is a leaf and false if


x is an internal node.

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees
A B-tree T is a rooted tree (whose root is T.root) having following properties:
1. Every node x has the following attributes:
1 2 … n
a. x.n, the number of keys currently stored in node x,
b. the x.n keys themselves, x.key1, x.key2,….,x.keyn, stored n=3, keys 5,1,3
in non-decreasing, so that x.key1<=x.key2<=…<=x.keyn, 1 3 5

c. x.leaf, a Boolean value that is true if x is a leaf and false if


x is an internal node.

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees
A B-tree T is a rooted tree (whose root is T.root) having following properties:
1. Every node x has the following attributes:
1 2 … n
a. x.n, the number of keys currently stored in node x,
b. the x.n keys themselves, x.key1, x.key2,….,x.keyn, stored n=3, keys 5,1,3
in non-decreasing, so that x.key1<=x.key2<=…<=x.keyn, 1 3 5

c. x.leaf, a Boolean value that is true if x is a leaf and false if 1 3 5

x is an internal node. Leaf nodes 0 2 4 6

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees
A B-tree T is a rooted tree (whose root is T.root) having following properties:
2. Each internal node x also contains x.n+1 pointers x.c1, x 1 2 ..… n
x.c2,…x.n+1 to its children. Leaf nodes have no children, x.n+1 pointers
and so their ci attributes are undefined. x.ci c1 c2 c3 … cn cn+1

3. The key x.keyi separate the ranges of keys stored in each


subtree, if ki is any key stored in the subtree with root n=3, keys 3,1,2,4
x.ci then, k1<=x.key1<=k2<=x.key2<=…<=x.keyn<=kn+1 x
3
x.c
x.key 1
i 1 2 4
k1 k2

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees
A B-tree T is a rooted tree (whose root is T.root) having following properties:
4. All leaves have the same depth, which is the tree’s height
h.
5. Nodes have lower and upper bounds, on the number of h
Leaf nodes
keys, they can contain.
These bounds are fixed integer t>=2 is called minimum Keys-1,2,3,4,5
degree of B-tree: Min. degree t=2
a. Every node other than the root, must have at least t-1 keys. min. keys=t-1=1
max. keys=2t-1=3
Every internal node other than the root thus has at least t
children. If the tree is non-empty, the root must have at least one
2
key.
1 3 4 5

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees
A B-tree T is a rooted tree having following properties: Keys-1,2,3,4,5,6,7,8
Min. degree t=2
5. b. Every node must contain at most 2*t-1 keys. min. keys=t-1=1
Therefore an internal node may have atmost 2*t children. max. keys=2t-1=3

A node is full if it has 2*t-1 keys.


2 4 6
Degree represents the lower bound on the
number of children a node in the B Tree can 1 3 5 7 8
have (except for the root). i.e the minimum
number of children possible.

Order represents the upper bound on the number of


children. ie. the maximum number possible.
B-Trees-Creation
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

1
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

1 2
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

1 2 3
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

1 2 3

1 3
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

1 3 4
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

1 3 4 5
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 Split and move up

1 3 4 5
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

1 3 4 5

2 4

1 3 5 6
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 4

1 3 5 6 7
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 4 Split and move up

1 3 5 6 7
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 4 Split and move up

1 3 5 6 7

2 4 6

1 3 5 7 8
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 4 6 Split the root

1 3 5 7 8
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 6

1 3 5 7 8
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 6

1 3 5 7 8 9
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 6 Split and move up

1 3 5 7 8 9
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 6 8

1 3 5 7 9 10
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 6 8

1 3 5 7 9 10 11
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 6 8 Split and move up

1 3 5 7 9 10 11
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 6 8 10

1 3 5 7 9 11 12
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

2 6 8 10

1 3 5 7 9 11 12 13
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3
1.Split and move up
4

2.Split and move up


2 6 8 10

1 3 5 7 9 11 12 13
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

4 8

2.Split and move up


2 6 10

1 3 5 7 9 11 12 13
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

4 8

2 6 10 12

1 3 5 7 9 11 13
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

4 8

2 6 10 12

1 3 5 7 9 11 13 14
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

4 8

2 6 10 12

1 3 5 7 9 11 13 14
B-Trees-Creation…
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Degree t=2
min. keys=t-1=1
max. keys=2t-1=3

4 8

2 6 10 12

1 3 5 7 9 11 13 14 15
B-Trees-Insert Operation
Since B Tree is a self-balancing tree, you cannot force insert a key into just
any node.

The following algorithm applies:


• Run the search operation and find the appropriate place of insertion.
• Insert the new key at the proper location, but if the node has a maximum
number of keys already:
• The node, along with a newly inserted key, will split from the middle
element.
• The middle element will become the parent for the other two child
nodes.
• The nodes must re-arrange keys in ascending order.
B-Trees-Insertion
Minimum degree is t=3.

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Insertion…
Minimum degree is t=3.

Insert B

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Insertion…
Minimum degree is t=3.

Insert Q

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Insertion…
Minimum degree is t=3.

Insert L

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Insertion…
Minimum degree is t=3.

Insert F

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
Design and Analysis of
Algorithms

B-Trees Deletion
B-Trees-Deletion
Minimum degree is t=3 Min. keys=t-1=2 Max. keys=2t-1=5
Case 1: If the key is in node x and x is leaf, delete key k from x.

Delete F

x
Key F is in x
x is leaf node

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Deletion
Minimum degree is t=3.
Case 2:If the key k is in node x and x is an internal node, do the following:
a. if the child y that precede k in node x has at least t keys, then find the predecessor k’
of k in the subtree rooted at y. Recursively delete k’and replace k by k’in x.

k is M
x Delete M

y (L) precedes k(M) has at least t keys

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Deletion
Minimum degree is t=3.
Case 2:If the key k is in node x and x is an internal node, do the following:
b. if y has fewer than t keys, then symmetrically, examine the child z that follows k in
node x. If z has at least t keys, then find the successor k’of k in the subtree rooted at
z. Recursively delete k’and replace k by k’in x.
k is G
x Delete G J

KL
y (E) precedes k(G) has fewer than t keys
z (J) follows k(G) in x and z has at least t keys
k’ (J) is successor of k(G)

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Deletion
Minimum degree is t=3.
Case 2:If the key k is in node x and x is an internal node, do the following:
c. Otherwise, if both the y and z have only t-1 keys, merge k and all of z into y, so that
x loses both k and pointer to z, and y now contains 2t-1 keys, Then free z and
recursively delete k from y.
k is G
Delete G
x

y and z both have t-1 keys


Merge k, all z into y so that x deletes pointer of k and z DEGJK

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Deletion
Minimum degree is t=3.
Case 2:If the key k is in node x and x is an internal node, do the following:
c. Otherwise, if both the y and z have only t-1 keys, merge k and all of z into y, so that
x loses both k and pointer to z, and y now contains 2t-1 keys, Then free z and
recursively delete k from y.
k is G
Delete G
x

y and z both have t-1 keys


Merge k, all z into y so that x deletes pointer of k and z DEGJK

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Deletion
Minimum degree is t=3.
Case 3: If the key k is not present in internal node x, determine the root x.ci of the appropriate subtree that must
contain k, if k is in the tree at all. If x.ci has only t-1 keys, execute step 3a or 3b as necessary to guarantee that we
descend to a node containing at least t keys. Then finish by recursing on the appropriate child of x.
b. if x.ci and both of x.ci’s immediate siblings have t-1 keys, merge x.ci with one sibling, which
involves moving a key from x down into the new merged node to become the median key for
that node.

Delete D

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Deletion
Minimum degree is t=3.
Case 3: If the key k is not present in internal node x, determine the root x.ci of the appropriate subtree that must
contain k, if k is in the tree at all. If x.ci has only t-1 keys, execute step 3a or 3b as necessary to guarantee that we
descend to a node containing at least t keys. Then finish by recursing on the appropriate child of x.
b. if x.ci and both of x.ci’s immediate siblings have t-1 keys, merge x.ci with one sibling, which
involves moving a key from x down into the new merged node to become the median key for
that node.

Delete D

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-Deletion
Minimum degree is t=3.
Case 3: If the key k is not present in internal node x, determine the root x.ci of the appropriate subtree that
must contain k, if k is in the tree at all. If x.ci has only t-1 keys, execute step 3a or 3b as necessary to
gaurantee that we descend to a node containing at least t keys. Then finish by recursing on the
appropriate child of x.
a. if x.ci has only t-1 keys but has an immediate sibling with at least t keys, give x.ci an extra key by
moving a key from x down into x.ci, moving a key from x.ci’s immediate left or right sibling up into
x, and moving appropriate child pointer from the sibling into x.ci.

Delete B

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
Design and Analysis of
Algorithms

B-Trees-Height
B-Trees-height…
Degree= t Min. Keys=t-1 Max. Keys=2t-1
Depth Number of nodes
1 0 1

1 2
t-1 t-1

t-1 ……… t-1 t-1 ……… t-1 2 2. t

t-1 ……… t-1 t-1 ……… t-1 t-1 ……… t-1 t-1 ……… t-1 3 2. t2

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-height…
Depth Number of nodes
0 1
1
1 2.t0

t-1 t-1
2 2. t1
t-1 ……… t-1 t-1 ……… t-1
3 2. t2
t-1 ……… t-1 t-1 ……… t-1 t-1 ……… t-1 t-1 ……… t-1 . .
. .
. .
h 2. th-1

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-height…
If a B-tree has height h, the
1
number of its nodes is
minimized when the root
t-1 t-1
contains one key and all other
t-1 ……… t-1 t-1 ……… t-1 nodes contain t-1 keys. In this
case, there are 2 nodes at
t-1 ……… t-1 t-1 ……… t-1 t-1 ……… t-1 t-1 ……… t-1 depth 1, 2t nodes at depth 2,

2t2 at depth 3 and so on, until


at depth h there are 2th- 1
Total nodes= 1 + (2.t0 + 2.t1 + 2.t2 + ………… + 2.th-1 )
nodes
Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-height…
n >= 1 + (t-1) (2.t0 + 2.t1 + 2.t2 + ………… + 2.th-1 ) Since every node except the
n >= 1 + (t-1).2.(t0 + t1 + t2 + ………… + th-1 ) root have (t-1) keys. So we
multiply the expression by (t-
n > = 1+ (t-1). 2. σ ℎ𝑖 = 𝑡𝑖−1 1)
𝑡 ℎ −1
1
n>= 1+ 2. (t-1).
𝑡 −1
n>= 1+ 2. (th-1)
n>= 1+ 2. th -2
n>= 2. th -1
n+1>= 2. th
th <= 𝑛+1 Take log on both sides:
2
𝑛 +1
log(th)<= log( )
2
𝑛 +1
h log t <= log( )
2

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees-height…
𝑛 +1
h log t <= log( )
2
log(𝑛+1
2
)
h <= log t
𝑛 +1
h <= log𝑡
2

Source: Intro. to Algorithms, 3rd Edition, Thomas H. Coreman, Charles E. Leiserson, Ronals L. Rivest, Clifford Stein
B-Trees- …
Advantages of B-Trees:
• B-Trees are well suited for big data sets and real-time applications because they
have a guaranteed time complexity of O (log n) for fundamental operations like
insertion, deletion, and searching.
• B-Trees can balance themselves.
• High throughput and concurrency.
• Efficient use of the storage space.

Disadvantages of B-Trees:
• They are dependent on disk-based data structures and can use a lot of disc space.
• Not always the greatest option.
• Comparatively slow to other data structures.
B-Trees- Applications
B-trees are widely used in various applications due to their efficient storage and retrieval capabilities,
especially in scenarios involving large datasets and disk-based storage. Here are some common
applications of B-trees:
1.Large databases employ it to access information stored on discs.
2.Using the B-Tree, finding data in a data set can be done in a great deal less time.
3.Multilevel indexing is possible with the indexing feature.
4.The B-tree method is also used by the majority of servers.
5.In CAD systems, B-Trees are used to catalogue and search geometric data.
6.Other applications of B-Trees include encryption, computer networks, and natural language
processing.
7.Since accessing values stored in a large database that is stored on a disc takes a long time, B
trees are used to index the data and provide quick access to the actual data stored on the disks.
B-Trees-Summary
 B Tree is a self-balancing data structure for better search, insertion, and deletion of
data from the disk.
 B Tree is regulated by the degree specified
 B Tree keys and nodes are arranged in ascending order.
 The search operation of B Tree is the simplest one, which always starts from the root
and starts checking if the target key is greater or lesser than the node value.
 The insert operation of B Tree is rather detailed, which first finds an appropriate
position of insertion for the target key, inserts it, evaluates the validity of B Tree
against different cases, and then restructure the B Tree nodes accordingly.
 The delete operation of B Tree first searches for the target key to be deleted, deletes
it, evaluates the validity based on several cases like minimum and maximum keys of
the target node, siblings, and parent.
Example 1
Create B-Tree of order 5 from the following list of data items:
20, 30, 35, 85, 10, 55, 60,
For the given list of elements as 20 30 35 85 10 55 60 25. The B-Tree of order 5 will be created as
follows

Step 1: Insert 20, 30, 35 and 85

Step 2: Insert 10
Step 3: Insert 55

Step 4: Insert 60 Step 5: Insert 25

Final B-tree created after inserting all


the given elements.
Example 2
Example 2
key : 1,12,8,2,25,6,14,28,17,7,52,16,48,68,3,26,29,53,55,45,67.
Order = 5

Final B-tree created after inserting all the given elements.


Any Questions ?
Dr. Anand Singh Jalal
Professor
Email: [email protected]

You might also like