Computer Science 112:

Introduction to Computer Science II

Gregory M. Kapfhammer


flickr photo shared by Billboard Art Project under a Creative Commons ( BY-NC-ND ) license

Color Scheme

Key Concept

Corresponding Diagram

In-Class Discussion

In-Class Activity

Details in the Textbook

Limitations of the tree?

Still, not efficient searching!

Hashtables to the rescue!

Well, sort of ...

Associative arrays

Key, value pairs

Check your repository

Compile and run the WordCount example

Try different text files as input

What is the output?

How does the hashtable work?

Arbitrary objects

Hash code

Compression function

Bucket array

See Figure 10.5 for more details

Return to the share repository

Compression Functions

Hash Codes

What is the output of these two programs?

What could go wrong with hashtables?

Collisions could make the search slower!

See other programs for more details

Any questions about hashtables?