Giter Site home page Giter Site logo

fasthashtable's Introduction

Fast hash table implementation


Requiremtns

Required to impelement hash table with decreased amount of dynamic memory allocations (new operator calls). Implemented hash table must provide API to overriding comparator and hash function.

Implementation description

Main idea

Main idea to decrease new calls count is to use hash table with open addressing instead classic hash table with chaining. In this repo implemented variation of hash table published in article on habr with internal table size equal to power of 2 for fast mod computation. Another option - use prime numbers for table size can decrease table's memory footprint is harder to implement and leads to longer mod computation.

Details

To use this hash map user need to include header file with custom_map implementation.

custom_map provides following base methods:

  • insert
  • erase
  • search which returnz Iterator on found object (or end otherwise)

Also, it's possible to provide own custom hash function and comparator as template args like in std::unordered_map.

Testing

Суть

Added only simple tests for integer keys.

Launching

Build:

g++ -std=c++17 -pedantic -Wall test.cpp -o run

Run:

./run

Work done and tested on Linux OS.


Made by Maksim Bronnikov

fasthashtable's People

Contributors

m-bronnikov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.