Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question No. 3 [10 Marks) We wish to build a Hash Table, which is able to deal with collision by using linear and quadratic probing.

image text in transcribed

Question No. 3 [10 Marks) We wish to build a Hash Table, which is able to deal with collision by using linear and quadratic probing. Please write a public class HashimQuad as follows public class HashlinQuad private int[] table://hash table private int size://current number of elements private int capacity //capacity of the hash table private HashlinQuad (int size} | table = new int[size] ) public int addin (int obj) { ... //add obj into table using linear probing 1 public int addQuad (Int op) ... //add obj into table using quadratic probing ) ) 1. Implement the two methods addin and addQuad that apply linear and quadratic probing respectively. 2. Test your implemented methods additin and addQuad. To this end, create the following two objects in class HashLinQuad linlashlable = new HashLinQuad(1249). HashLinQuad quad HashTable = new HashLinQuad(1249): 3. Please insert the same 1000 random integer values in the same order) into: a the object WinHashTable' by using the method addin' and count the number of collisions. b. the object quadHashTable by using the method addQuad' and count the number of collisions. 4. According to the results, compare and discuss both collision resolution strategies as a comment in your implementation (eg, directly below the lines above)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions