hash tables
data structure that employs an array (which may be on the stack or the heap and a hashing function. it may also include linked lists to allow for collisions
multi-file development
refers to spreading your code across multiple files; the intent is to centralize common code that other developers could use
key
portion of your data used to map to bucket
value
bucket number in hash table array (aka index number)
hash function
maps key to value (common variations follow)
associative array
what a hash table actually is i.e., an array whose index is associated with your custom data type
collision
when more than 1 key maps to the same value, the result is a bucket that contains more than one data item. we use linked lists to allow collisions a “perfect” hash table has no collisions (but then it becomes more of a lookup table)
load factor
number of entries in table or the number of buckets. represents a metric that allows you to determine the tradeoff between time to search and space costs
function pointers
pointers that point to functions. the pointer stores the address in program memory of the first instruction in the function
arrays
linked lists
review of our implementation of a hash table
combination of an array, linked lists, and a hashing function
to insert a node into a hash table:
to find a node in a hash table
uses of function pointers
can “call” a function inside a function that has been passed as an argument
offers tremendous flexibility in writing libraries used by other programmers