Skip to content

Instantly share code, notes, and snippets.

@Jidake
Jidake / Test_Krapivn_Hash.py
Last active March 1, 2025 09:37
I wanted to get computational prooof of how much the new Krapivin hash algorithm was faster than the traditional one
import numpy as np
import matplotlib.pyplot as plt
import random
# Simulation Parameters
table_size = 10000 # Hash table capacity
n_trials = 1000 # Number of search operations per load factor
load_factors = np.linspace(0.1, 0.95, 10) # True load factors from 10% to 95%
# Hash function (simple multiplication method)