IT University of Copenhagen
March 27, 2006
Abstract
This lecture note presents and analyses two simple hashing algorithms:“Hashing with Chaining”, and “Cuckoo Hashing”. The analysis uses only very basic (and intuitively understandable) concepts of probability theory, and is meant to be accessible even for undergraduates taking their first algorithms course.
1. Introduction
A dictionary is a data structure for storing a set of items (e.g., integers or strings), that supports three basic operations:Lookup(x) which returns true if x is in the current set, and false otherwise;
Insert(x) which adds the item x to the current set if not already present;
Delete(x) which removes x from the current set if present.
A common variant is to associate some information with each item, which is returned in connection with lookups. It is a simple exercise to augment the algorithms presented here with this capability, but we will describe just the basic variant.