Chapter 5 - Hash Tables
Open addressing
Collision resolution technique where collisions are resolved by looking for an empty bucket elsewhere in the table
Chaining
Collision resolution technique where each bucket has a list of items (more than one item per bucket)
Empty-after-removal bucket
Had an item removed that caused the bucket to now be empty
Empty-since-start bucket
Has been empty since the hash table was created
probing sequence
Iterating through sequential i values to obtain the desired index in hash table
encryption
alteration of data to hide the original meaning
hash function
computes a bucket index from the item's key
modulo operator, %
computes the integer remainder when dividing two numbers. Is a commonly used hash function
password hashing function
cryptographic hashing function that produces a hash value for a password; databases commonly store hashes instead of actual passwords
hash table
data structure that stores unordered items by mapping (hashing) each item to a location in an array (or vector) -main advantage is that searching, inserting, or removing an item may require only an O(1) runtime
bucket
each hash table array element
cryptograpy
field of study focusing on transmitting data securely
Linear probing
handles a collision by starting at the key's mapped bucket, and then linearly searches subsequent buckets until an empty bucket is found
Quadratic Probing
handles a collision by starting at the key's mapped bucket, and then quadratically searches subsequent buckets until an empty bucket is found: (H+c1∗i+c2∗i^2)mod(tablesize) is used to determine the item's index in the hash table
cryptographic hash function
hash function designed specifically for cryptography; commonly used for encrypting and decrypting data
direct access table
hash table with a direct hash function
modulo hash function
key % N (hash table is size N)
perfect hash function
maps items to buckets with no collisions. If number of items and all possible item keys are know beforehand, perfect hash function can be created -insertion,search, and remove all are O(1)
collision
occurs when an item being inserted into a hash table maps to the same bucket as an existing item in the hash table
double hashing
open-addressing collision resolution technique that uses 2 different hash functions to compute bucket indices. Using hash functions h1 and h2, a key's index in the table is computed with the formula ( h1(key) + i∗h2(key) )mod(tablesize)
decryption
reconstruction of original data from encrypted data
multiplicative string hash
repeatedly multiplies the hash value and adds the ASCII (or Unicode) value of each character in the string
mid-square hash
squares the key, extracts R digits from the result's middle and returns the remainder of the middle digits divide by hash table size, N
key
the value used to map to an index in a hash table. Every key is unique
direct hash function
uses the item's key as the bucket index