Abstract
So far, you have only considered storing keys in your hash tables. Most of the techniques for implementing hash tables do not depend on whether you store simple keys or whether you associate application values with them. The setup where you only store keys that you can also use as hash keys, however, is practically never used in real-world applications. This chapter is about storing application values in bins together with their hash keys. You can download the code at https://github.com/mailund/JoyChapter5 .
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
This will fail if you try to map keys to null pointers; then you would need to add the contains operation as a separate function.
- 2.
If you worry that the earlier implementations where you did use the contains function are inefficient, don’t. There, you would not update the link if it was already found in the list, and if it was not, you prepended a new link. You wouldn’t search through the linked list twice in those operations.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Thomas Mailund
About this chapter
Cite this chapter
Mailund, T. (2019). Adding Application Keys and Values. In: The Joys of Hashing. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4066-3_5
Download citation
DOI: https://doi.org/10.1007/978-1-4842-4066-3_5
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-4065-6
Online ISBN: 978-1-4842-4066-3
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)