This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple script used in extendible hashing tasks for course TDT4145 at NTNU | |
import math | |
inputs = [int(n) for n in input("Paste list of keys, sep with ',': ").split(',')] | |
n = input("Enter hash function, k mod ") | |
if n == '': | |
# Fallback if no hash function is given | |
m = max(inputs) | |
n = math.floor(math.sqrt(m))**2 | |
else: n = int(n) |