Giter Site home page Giter Site logo

polleanker / hashing-algorithms Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 131 KB

Implementation of Hashing with collision handling, utilizing Chaining, Linear Probing, Quadratic Probing and Double Hashing.

Python 100.00%
hashing open-addressing chaining python python-3 linear-probing double-hash quadratic-probing algorithms-and-data-structures

hashing-algorithms's Introduction

Collision Handling for Hash Algorithms

This project contains python code for evaluating the performance of collision handling in hash maps. It implements Chaining, Linear Probing, Quadratic Probing and Double Hashing, with hash functions including Division, Multiplication and Prime.

Usage

The main.py file holds everything needed to actually test data.

  • 1 - Create a hash map using either the OpenAddressing or Chaining class. (Specify the desired size (should match size of input data), hash function ("Division", "Multiplication" or "Prime) and desired probing method ("Linear", "Quadratic" or "Double") if using open addressing.
  • 2 - Call the HashFunctions.hash_evaluation() function with a hash map, data set, item to delete (integer) and item to find (integer).
  • 3 - You're all set!

Your main.py (or whatever you want to call it) should look something like this:

from OpenAddressing import OpenAddressing
import HashFunctions
import random

hash_map = OpenAddressing(150, "Division", "Linear")
item_to_delete = random.randrange(0,3000)
item_to_find = random.randrange(0,3000)
HashFunctions.hash_evaluation(hash_map, "datasetname.txt", item_to_delete, item_to_find)

The output of the code above will look something like this in the terminal;

Included Data Sets

The included data sets are randomly generated lists with an integer key and a corresponding "firstname lastname" string value. Any data set of this form should work, do bear in mind though, that the code as is cannot handle other than integer keys. If you're wondering how they look, here's a little sneak peek:

hashing-algorithms's People

Contributors

polleanker avatar

Watchers

 avatar

Forkers

rabiasm

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.