8000 GitHub - MPCodeWriter21/Python_Hashmaps: Pure Python implementation of hash-tables using different techniques(Open addressing & Separate Chaining) for solving hash collisions.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Pure Python implementation of hash-tables using different techniques(Open addressing & Separate Chaining) for solving hash collisions.

Notifications You must be signed in to change notification settings

MPCodeWriter21/Python_Hashmaps

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

pyhashmaps is a fully annotated Python package which has several functional hashmap classes for educational purposes.

All classes support common operations on MutableMapping type.

It has a class hierarchy of:

- Open Addressing:
    - Linear Probing
    - Quadratic Probing
    - Double Hashing
- Separate Chaining:
    - Using DynamicArray
    - Using LinkedList
    - Using Binary Search Tree

Requirements

It's tested on Python 3.10 & 3.11.

Installation

If you have git installed:

pip install git+https://github.com/amirsoroush/Python_Hashmaps.git

Otherwise:

pip install https://github.com/amirsoroush/Python_Hashmaps/tarball/main

Usage

It has the same interface as the built-in dict class.

>>> from pyhashmaps import (
...                     LinearProbingHashMap,
...                     QuadraticProbingHashMap,
...                     DoubleHashingHashMap,
...                     DynamicArrayHashMap,
...                     LinkedListHashMap,
...                     BSTHashMap,
...                     )
>>>
>>> hashmap = LinearProbingHashMap()
>>> hashmap = LinearProbingHashMap[str, int]()
>>> hashmap["a"] = 10
>>> hashmap
LinearProbingHashMap({'a': 10})
>>> hashmap.update({"b": 20, "c": 30})
>>> len(hashmap)
3
>>> for k, v in hashmap.items():
...     print(k, v)
... 
c 30
a 10
b 20
>>> hashmap.clear()
>>> 

About

Pure Python implementation of hash-tables using different techniques(Open addressing & Separate Chaining) for solving hash collisions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%
0