# Set representation. Hashing

• Alexander Shen
Chapter
Part of the Springer Undergraduate Texts in Mathematics and Technology book series (SUMAT)

## Abstract

In chapter 6 we considered several representations for sets whose elements are integers of arbitrary size. However, all those representations are rather inefficient: at least one of the operations (membership test, adding/deleting an element) runs in time proportional to the number of elements in the set. This is unacceptable in almost all practical applications.

It is possible to find a set representation where all three operations mentioned run in time C log n (in the worst case) for sets with n elements. One such representation is considered in the next chapter. In this chapter, we consider another set representation that may require n operations in the worst case but is very efficient in a “typical”case. The method is called hashing.

We consider two versions of this technique. Open addressing (section 13.1) is somehow simpler (and more efficient in terms of space), especially if we do not need deletion. Then we consider (section 13.2) hashing with lists; this version of hashing is more flexible and easier to analyze.

## Keywords

Hash Function English Word Arbitrary Size Correct Word Natural Place
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.