Skip to content

nKtistakis/Linear-Hash-Table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Linear-Hash-Table

A linear hash table implementation developed in Java.

Description

This linear hash table was developed to store hashed data for easy and fast access, as the value correlates to the hash value of its key. Even though the table needs a given size to initialize, in the case of the size exceeds, the table will automaticly double its size, to be able to store the new Entries given. In contrast, if the Entries of the table are one fourth of the table's total size, the table's size will subduplicate, in order to be memory efficient.

Upon creation, the Linear Hash Table will be filled with null Entry objects.

Supported methods

  • Insert to table: void put(K key, V value) Accepting 2 non-nullable values, of which the key variable will get its hashed value, matched to an index on the table in order for the value variable to get stored there. If the index is already occupied the value will be stored in the next available index, following a circular path. After the successfull insertion, the table will rehash and check if it needs to alter its size.

  • Remove from table: V remove(K key) The search starts from the expected index of the key and keeps incremating until there is a match. Then a replace of the Entries with a null Entries is perfomed and the deleted value gets returned. In order to not cause an access problem to the table (since it will miss a hashed index value), the table gets rehashed in order the keys hashed values to match their indexes.

Run Instructions

In order for tests to execute, run:

  • cd ../LinearHash

  • mvn test (inside ../LinearHash direcotry!)

About

A linear hash table implementation developed in Java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages