Skip to content

Implementation of a hash table in C++ with different exploration and dispersion functions implemented.

License

Notifications You must be signed in to change notification settings

KeflerExe/HashTable-C-V2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

LinkedIn

About The Project

The scatter search technique is implemented using the data structure known as a scatter table, or hash table. This implementation of the hash table has configuration options to work with the following variants of the technique:

● For simplicity, we assume that the information record stored in the hash table should be set to match the type of the key used.

● The size of the scatter table, which we denote hereafter as tableSize, indicates the number of positions in the table. As we have seen, this parameter does not only indicate the amount of memory that is reserved when constructing the table, but it also affects the behavior of the scatter function and the scan function.

● The scatter function maps the value of the key k of type Key to a table position in the range [0..tableSize-1].

The following scatter functions are implemented:

■ Module, h(k) = k % tableSize.

■ Sum-based, h(k) = sum(ki) % tableSize.

■ Pseudo-random, h(k) = {srand(k); rand()}.

● To resolve collisions in the scatter table i implemented the next techniques:

○ Open scattering, each position in the hash table contains a dynamic, list-like data structure where all synonyms, generated by the scattering function, are inserted.

○ Closed dispersion, each position of the hash table contains a static, array-like data structure where all the synonyms generated by the dispersion function are inserted where the maximum number of records that can be stored in that position is set.

● In the implementation of the closed dispersion technique, the following additional parameters are defined;

○ The block size, which we denote blockSize, indicates the maximum number of records that can be stored in the same table position.

○ The scan strategy for resolving the overflow in a block implements the following scan functions, where k is the value of the key, and the parameter i is the number of the scan attempt.

■ Linear scan, g(k,i) = i.

■ Quadratic scan, g(k,i) = i2.

■ Double dispersion, g(k,i) = f(k) * i

■ Redispersion, g(k,i) = f(i)(k).

+ The elimination technique is not implemented. Only insertion and search are implemented at the moment.

(back to top)

Built With

  • C++

(back to top)

Getting Started

Prerequisites

None

Installation

No installation required :)

(back to top)

Usage

  1. Download the files
  2. Compile with g++
g++ bigint_main.cc bigint_func.cc
  1. All ready!

(You can find instructions about the arguments of the program by running the program whit the argument "-help")

./a.out --help

(back to top)

License

Distributed under the MIT License.

(back to top)

Contact

Joel Óscar - josc.margut@gmail.com

(back to top)

About

Implementation of a hash table in C++ with different exploration and dispersion functions implemented.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages