4.2.6 Hash Tables

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

10 Terms

1
New cards

What is a hash table?

Data structure that creates a mapping between keys and values

2
New cards

What is a hashing algorithm?

An algorithm which takes an input and returns an unique hash which cannot be reversed

3
New cards

How are elements looked up in a hash table?

- Key is hashed

- Corresponding hash is queried

- Desired information is located

4
New cards

What is a collision?

When a hashing algorithm generates the same address for two different keys

5
New cards

How can collisions be resolved?

  • Placing the item in the next address

  • Implementation of a skip value

6
New cards

How can errors be avoided?

  • Ensure that the load factor is not greater than about 50-70% of the table size

  • Using a prime number as the table size

7
New cards

What are the three key hashing algorithms?

  • Mid-square

  • Folding

  • Mod

8
New cards

How does the mid-square method work?

  • Square the item

  • Extract the middle of the resulting digits

  • Hash = result MOD number of addresses

9
New cards

How does the folding method work?

  • Divide item into equal pieces

  • Sum pieces together

  • MOD by table size

10
New cards

How can alphanumeric data be hashed?

  • Convert with ASCII code

  • Apply hashing algorithm