algorithm - Hash Table with Chaining (Table Doubling) -


  1. how fix hash table chaining when items hash same slot (one giant linkedlist)?
  2. does hash table chaining uses table doubling? if when time double size of table.

expanding on answer nikic's comments:

for first question, unfortunately real possibility when implementing chained hash table. assuming have hash function - or, better yet, choosing hash function involves element of randomness - extremely unlikely. unfortunately, bad people use take down web servers. not long ago, attack called "hash dos" developed whereby craft bunch of specialized requests web server cause stored in same slot in chained hash table, led huge performance drops , took websites offline. news, though, many programming language implementations have been updated hash tables aren't vulnerable things this.

for second question, answer "it depends." implementations of chained hash tables rehash , grow when load factor gets high (usually, load factors between 1 , 2 common). implementations not, though. example, concurrenthashmap implementation in java, believe, not rehashing because doing not feasible when many reads , writes executing concurrently.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -