You are on page 1of 4

B-Trees

B-Trees

Search for key R Work =

( h ) = ( log t n )

B-Trees

B-Trees

Each Disk-Read or Disk-Write = one Basic unit of work O(1)

Typical Node x See example on whiteboard

B-Trees

t 1 # Keys 2t 1

t # Children 2t
# Keys = 2t 1 node is full
Thm: Let T be a B-tree with n>2 keys and of minimum degree t 2 . Then the height h of the B-tree is bounded above by n + 1

t = 2 2-3-4

B-Tree

Each node is approx. one page of HD memory

h log t 2

B-Trees

B-Trees

Search for key R

( h ) = ( log t n )

Work =

( h ) = ( log t n )

B-Trees

B-Tree Insertion

To INSERT, we will need procedures for splitting full nodes

B-Trees

B-Trees

B-Tree-Split

B-Trees

B-Trees

B-Tree-Split

B-Trees

B-Trees

Splitting a root node

Inserting Keys in a B-Tree B-

B-Tree Deletion

We must make sure that the number of keys in a non-root node is always at least t

Deleting Keys in a B-Tree B-

Deleting Keys in a B-Tree (Cont.) B-

You might also like