Skip to main content

Set representation. Hashing

  • Chapter
  • First Online:
  • 3831 Accesses

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.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD   69.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alexander Shen .

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer Science+Business Media, LLC

About this chapter

Cite this chapter

Shen, A. (2010). Set representation. Hashing. In: Algorithms and Programming. Springer Undergraduate Texts in Mathematics and Technology. Springer, New York, NY. https://doi.org/10.1007/978-1-4419-1748-5_13

Download citation

Publish with us

Policies and ethics