Computer Algorithms II Lecture Notes

23 September 2008 • Implementing Hash Tables


Outline

  • Hash table ADT.

  • Hash functions.

  • Scatter tables.

    • Open addressing.

    • Chaining

  • Dynamic hash tables.

hash

Hash Table ADTs

ADT Implementation

Implementation Details

Chained Operations

Open-Address Hash Tables

Private ADT Operations

Public ADT Operations

Hash Table Size

Hash Function Issues

Hash Functions

Hash Function Sources

Dual Hash Functions

Hash Function Mechanics

Keys To Integers

Hashing by Bit Twiddling

Hashing by Division

Hashing by Multiplication

Comments

Evaluating Hash Functions

Bad Hash Example

Good Hash Example

A Good Hash?

XOR Hashing

XOR Hashes

Low-Order Bits

Does It?

Does It?

Linear Congruential Hashing

Linear Congruential Results

Hash-Table Size

The Current State

Dynamic Hash Tables

Dynamics In Use

Dynamic Components

Addressing

Tree-Based Addressing

Tree-Based Collisions

Big Buckets

Storage

Directories

No Directories

Growing and Shrinking

Directory Growth

Directoryless Growth

directoryless expansion

  • Growing a directoryless hash is roughly the same as for a directory hash.

  • But it uses more time and space.

  • There's a more efficent incremental scheme.

    • But it's also less effective.

Shrinking

shrinking

Summary

References

Credits


This page last modified on 12 September 2008.

Creative
    Commons License