Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8. (10 Points) Implement put and get method inside QuadraticProbingHashST , which uses quadratic probing to resolve conflicts. QuadraticProbingHashST is similar to LinearProbingHashSt, except in

8. (10 Points) Implement put and get method inside QuadraticProbingHashST, which uses quadratic probing to resolve conflicts. QuadraticProbingHashST is similar to LinearProbingHashSt, except in picking with table index to try when there are conflicts. With quadratic probing, the initial index for a key is key.hashCode()%tableSize. If that place is taken, the next place to try is initialIndex + 1*1, if it is taken then try initialIndex + 2*2, if it is taken then try initialIndex + 3*3, etc. The following tables shows the contents of keys array After each key insertion in that order.

image text in transcribed

8. (10 Points) Implement put and get method inside QuadraticProbingHashST, which uses quadratic probing to resolve conflicts. QuadraticProbingHashST is similar to LinearProbingHashSt, except in picking with table index to try when there are conflicts. With quadratic probing, the initial index for a key is key.hashCode()%tableSize. If that place is taken, the next place to try is initiallndex + 1*1, if it is taken then try initiallndex 2*2, if it is taken then try initiallndex + 3*3, etc. The following tables shows the contents of keys array After each kev insertion in that order 4 6 7 8 Initial After 89 After 18 18 18 18 18 89 89 89 89 89 After 4949 After 58 49 58 58 69 After 6949 /If search key exists in the table, return associated value; *otherwise return null public Value get (Key key) ( // Provide your implementation here throw new UnsupportedOperationException(); /Insert the key value pair into the table *If the key exists in the table, update the associated value with new value; *No resize is needed for this implementation public void put (Key key, Value val) ( // Provide your implementation here throw new UnsupportedOperationException()

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions