Hash tables and hashing functions, collisions and resolution, graphs (directed/undirected, weighted), adjacency matrix and adjacency list, and graph traversals.
Hash tables
A hash table stores key–value pairs for very fast lookup. A hash function maps a key to an index in an array (e.g. index = key MOD tableSize). Ideally lookup, insertion and deletion are close to O(1).
A collision happens when two keys hash to the same index. Resolution methods:
A good hash function spreads keys evenly to minimise collisions; performance degrades as the table fills (high load factor).
Viewing only
This content is free to read on superexams.com and cannot be printed or downloaded.
Read the full note, free
Create a free account to read this note in full. Every free account gets 2 complete revision notes, no card needed.