The Hash Tables Data Structure Coursework

Exclusively available on Available only on IvyPanda®
This academic paper example has been carefully picked, checked and refined by our editorial team.
You are free to use it for the following purposes:
  • To find inspiration for your paper and overcome writer’s block
  • As a source of information (ensure proper referencing)
  • As a template for you assignment

Hash tables are a data structure that maps its contents to particular keys. To achieve this mapping, programmers use hash functions to transform data of the stored elements into identifiable keys, referred to as buckets. Ideally, a hash function transforms each possible input value to a unique key, allowing for exceptionally quick data storage and retrieval that does not depend on the hash table’s size (Tutorialspoint.com, n. d.). However, sometimes a hash function can assign the same key to multiple distinct objects; this event is called a collision. There are two ways of resolving collisions: chaining and linear probing. In chaining, each bucket is assigned with an additional data structure. Buckets for chaining are commonly implemented using linked lists to store elements that share a key. In linear probing, each bucket can only store one element, and the algorithm tries to place new element in the first available bucket in case of a collision.

Hash tables allow data to be stored and retrieved quickly. However, the hash function itself takes some time to execute. Therefore, in situations where one does not need to search for specific items often, hash tables are not the optimal solution. Moreover, though common hash functions exist, they do not necessarily create unique or rarely-repeating keys for the data with which they work. Thus, the data structure can require additional time to develop a custom hash function suited for the type of data meant to be stored. The choice between chaining and linear probing depends on how often one expects the hash function to create collisions and how much the amount of data will fluctuate. Chaining generally handles overflow well due to individual linked lists’ ability to expand and shrink as necessary. Linear probing, conversely, has a limited maximum size, thus limiting the maximum amount of memory the structure will take.

Reference

Tutorialspoint.com (n. d.).

More related papers Related Essay Examples
Cite This paper
You're welcome to use this sample in your assignment. Be sure to cite it correctly

Reference

IvyPanda. (2023, February 4). The Hash Tables Data Structure. https://ivypanda.com/essays/the-hash-tables-data-structure/

Work Cited

"The Hash Tables Data Structure." IvyPanda, 4 Feb. 2023, ivypanda.com/essays/the-hash-tables-data-structure/.

References

IvyPanda. (2023) 'The Hash Tables Data Structure'. 4 February.

References

IvyPanda. 2023. "The Hash Tables Data Structure." February 4, 2023. https://ivypanda.com/essays/the-hash-tables-data-structure/.

1. IvyPanda. "The Hash Tables Data Structure." February 4, 2023. https://ivypanda.com/essays/the-hash-tables-data-structure/.


Bibliography


IvyPanda. "The Hash Tables Data Structure." February 4, 2023. https://ivypanda.com/essays/the-hash-tables-data-structure/.

If, for any reason, you believe that this content should not be published on our website, please request its removal.
Updated:
1 / 1