DATA STRUCTURES AND ALGORITHMS CS 3139
Lecture:  February 18th, 1999




ANNOUNCEMENTS
 


REVIEW

Example of building

Rotations are based on the pattern exhibited by the tree
 

TODAY


B-TREES

B-tree of order M is an M-ary tree such that

  1. Data items are stored at leaves
  2. Non-leaf nodes store a max of M-1 keys to guide search.  Keys represents the smallest key in subtree i+1
  3. Root is either a leaf or a node that has 2 to M children
  4. All non-leaf nodes have ceil[M/2] to M children
  5. All leaves are at the same depth and have between ceil[L/2] and L children
In class, we looked at valid B-trees to illustrate how the specified properties are satisfied.
We also examined invalid B-trees.

Why B-trees?  Lets look at an example that illustrates the power of B-trees.

How can a B-tree help? keys = 32 bytes
B order M tree = M-1 keys
node = 8192
            32M - 32 bytes
            4M bytes
            8192 >= 36M -32 bytes ==> M = 228

Choose L so that we can maximize the number of records we can store on a disk block:  8192>= 256L ==> L=32
Each non-leaf node has at least 114 branches
Each Leaf has 16-32 records
10 million records =>  At least 625,000 leaves

Worst case tree analysis - i.e. root has 2 branches (not M):

We demonstrated how to perform insertions on B-trees Why does the root have 2-M children?  Answer:  If we need to split at the root, then the resulting tree still meets the B-tree criteria.

If we delete things, we may need to combine instead split to re-balance.
 

HASHING

lists - O(N)
trees - O(logN)
Can we get O(1)?  Yes!

Hash Tables

Hash Function Properties Issues in hashing Where are hash tables used:  CPU cache, etc.
 
 
 
 
  Nhat Minh Dau, nmd13@columbia.edu