Question
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.
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started