Computer Science 101

Data Abstraction

Gregory M. Kapfhammer


flickr photo by "Cowboy" Ben Alman shared 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

put(k,v)

get(k)

getKeys()

getValues()

getPairs()

Counting words with a HashTable

What is the input?

What is the output?

How will the HashTable help?

How does the HashTable work?

Map k,v and lookup k quickly!

A Cool Function + An Array

See Figure 10.5!

Arbitrary objects

Hash code

Compression function

Bucket array

See Figure 10.5 for more details

What could go wrong with HashTables?

Collisions could make the search slower!

See Table 10.2 for time complexities

Discuss these time complexities

Expected versus worst-case?

Security implications of poor performance?

Denial of service attacks!

Insert data to cause poor performance

We will explore HashTables in an assignment

Any questions about HashTables?