Free Online Flashcard Deck

7 Hash Tables Free Online FlashCards

Study 7 Hash Tables with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is a hash table?

Back

A hash table is a data structure that stores key–value pairs using an array, a hash function, and a collision-resolution strategy.

02
Front

How does hash-table lookup work?

Back

It computes the key’s hash value, maps it to a bucket or slot, examines entries there, and uses key equality to confirm the match.

03
Front

What must a hash function guarantee about equal keys?

Back

Equal keys must produce equal hash values, but unequal keys may produce the same hash value or bucket index.

04
Front

What is a hash-table collision?

Back

A collision occurs when two different keys are assigned to the same bucket or slot.

05
Front

How does separate chaining resolve collisions?

Back

Separate chaining stores all entries mapping to one bucket in a collection, such as a linked list or dynamically managed sequence.

06
Front

How does open addressing resolve collisions?

Back

Open addressing stores every entry directly in the table array and searches a probe sequence of alternative slots after a collision.

07
Front

What is linear probing?

Back

Linear probing checks consecutive positions using indexi=(h(k)+i) mod mindex_i = (h(k) + i) \bmod m.

08
Front

Why are tombstones used in open addressing?

Back

A tombstone marks a deleted entry while telling searches to continue probing, preventing a search from stopping too early.

09
Front

Why must entries be rehashed after resizing?

Back

It allocates a larger array and rehashes every entry because changing the bucket count changes the result of hash(key) mod mhash(key) \bmod m.

10
Front

How does geometric growth affect insertion complexity?

Back

A resize costs O(n)O(n) when it occurs, but geometric growth spreads these costs across insertions, giving amortized O(1)O(1) insertion.

11
Front

What are hash-table operation bounds?

Back

With good distribution and controlled load factor, search, insertion, and deletion are expected O(1)O(1), but each can be O(n)O(n) in the worst case.

12
Front

When is a hash table a strong data-structure choice?

Back

A hash table is preferable for fast average-case membership tests, key–value associations, and frequent unsorted insertion or deletion.