Professional Documents
Culture Documents
Chapter 5 Lec 3
Chapter 5 Lec 3
CHAPTER 5 LEC 3
Outline
B-Tree (introduction)
Hash function
Data compression
B-tree
Suppose you have 100,000 items in a BST
• Levels: ~log2100,000=17
• Meaning: disk may need to be accessed ~17 times
• Note: portion of data may be in memory
Data Access Times
RAM: ~50-150ns
Hard Disk Drive(HDD): ~ 9-15ms
HDD can be 100,000 times slower!
Search:
• Step 1: We determine the location
of the item in the table using the
hash function
• Step 2: We traverse the linked list
to extract the data
Separate Chaining…
Searching an item requires computing the hash function,
and then traversing the list.
• Computing Hash Function: takes nearly constant time
• Traversing the List: depends on load factor
Load factor(L)=[No of elements(M)]/[Table size(N)]
Unsuccessful search = O(1+L)
If the table gets too full, the running time for the
operations will start taking too long