Task: Implement a basic hash table without collision resolution.
File: no_collision_resolution.js
Test: no_collision_resolution.test.js
The above test program is unlikely to have collisions, but it's certainly possible for various hashing functions. With DJB2 (32 bit) and FNV-1 (64 bit) hashing functions, there are no collisions.
-
Implement a
HashTable
class andHashTableEntry
class. -
Implement a good hashing function.
Recommend either of:
- DJB2
- FNV-1 (64-bit)
You are allowed to Google for these hashing functions and implement from psuedocode.
-
Implement the
hash_index()
that returns an index value for a key. -
Implement the
resize()
,put()
,get()
, anddelete()
methods.
Task: Implement linked-list chaining for collision resolution.
File: LL_collision_resolution.js
Test: LL_collision_resolution.test.js
-
Modify
put()
,get()
, anddelete()
methods from no_collisions_resolution.js to handle collisions. -
There is no step 2.
Task: Implement load factor measurements and automatic hashtable size doubling.
-
Compute and maintain load factor.
-
When load factor increases above
0.7
, automatically rehash the table to double its previous size.Add the
resize()
method.
Task: Complete in any order you would wish. The files are arranged from easier to harder see below: