On hash table | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

On hash table

Write a program to implement a Hash Table data structure to store the product details with product id as key. Your program should contain the following functions. • HashTable(m): Creates a hash table T of size m. • Insert(T,k): Inserts an element into hash table T having key value k. • Search(T,k): Checks whether an element with key ‘k’ is present in hash table T s or not. • Delete(T,k): Deletes the element with key ‘k’ from hash table. Note: Assume that the deletion operation will always be a valid operation. i.e. the element to be deleted is present in the hash table. Input Format • The first line contains a character from ‘a’, ‘b’: -Character ‘a’ denotes collision resolution by Quadratic Probing with hash function h(k, i) = (h1(k) + c1i + c2i 2 ) mod m where h1(k) = k mod m , c1 and c2 are positive auxiliary constants and i [0, m 1]. – Character ‘b’ denotes collision resolution by Double Hashing with hash function. h(k, i) = (h1(k) + ih2(k)) mod m where h1(k) = k mod m, h2(k) = R(kmodR) R

6th Nov 2021, 2:05 AM
Prem Powar
Prem Powar - avatar
2 Answers
+ 4
Show your attempt. We can't help you unless you show how far you don't this and where you're stuck. Don't expect complete answer by others. So save your code on code playground and share it's link here. Also, tag the programming language you're using, not your first name =)
6th Nov 2021, 2:35 AM
Rishi
Rishi - avatar
+ 1
Yeah...ok i will
6th Nov 2021, 2:38 AM
Prem Powar
Prem Powar - avatar