Answer to Question #256285 in Python for Lastone

Question #256285
Write a python program to implement hash table with quadratic probing 1) insert item into hash table 2) remove item into hash table 3) check the size of hash table 4) Display Hash table
1
Expert's answer
2021-10-25T14:50:18-0400
def display(array1, n):
	for i in range(n):
		print(array1[i], end = "\t")
def Hashing(tb, n, array1, N):
	for i in range(N):
		v = array1[i] % n
		if (tb[v] == -1):
			tb[v] = array1[i]
		else:
			for j in range(n):
				t = (v + j * j) % n
				if (tb[t] == -1):
					tb[t] = array1[i]
					break
	display(tb, N)
array1 = [ 1,2,3,4,5,6,7,8,9]
N = 9
L = 9
hashTable = [0] * 9
for i in range(L):
	hashTable[i] = -1
Hashing(hashTable, L, array1, N)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS