Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement MyMap using open addressing with linear probing - Create a new concrete class that implements MyMap using open addressing with linear probing. For simplicity,

Implement MyMap using open addressing with linear probing - Create a new
concrete class that implements MyMap using open addressing with linear probing.
For simplicity, use f(key)=key% size as the hash function, where size is the hash-
table size. Initially, the hash-table size is 4. The table size is doubled whenever the
load factor exceeds the threshold (0.5).
Implement MyMap using open addressing with quadratic probing - Create a new
concrete class that implements MyMap using open addressing with quadratic
probing. For simplicity, use f(key)=(key+j2)% size as the hash function, where
size is the hash-table size and j0. Initially, the hash-table size is 4. The table size
is doubled whenever the load factor exceeds the threshold (0.5).
Implement MyMap using open addressing with double hashing - Create a new
concrete class that implements MyMap using open addressing with double
hashing. For simplicity, use f(key)=key% size, and f'(key)= PRIME -(key % PRIME)
as the first hash function and the secondary hash function, where size is the hash-
table size and PRIME is a prime smaller than the size. For example, we use 7 for a
hash-table size of 11. Initially, the hash-table size is 4. The table size is doubled
whenever the load factor exceeds the threshold (0.5). this is the code-> public interface MyMap {
/** Remove all of the entries from this map */
public void clear();
/** Return true if the specified key is in the map */
public boolean containsKey(K key);
/** Return true if this map contains the specified value */
public boolean containsValue(V value);
/** Return a set of entries in the map */
public java.util.Set> entrySet();
/** Return the value that matches the specified key */
public V get(K key);
/** Return true if this map doesn't contain any entries */
public boolean isEmpty();
/** Return a set consisting of the keys in this map */
public java.util.Set keySet();
/** Add an entry (key, value) into the map */
public V put(K key, V value);
/** Remove an entry for the specified key */
public void remove(K key);
/** Return the number of mappings in this map */
public int size();
/** Return a set consisting of the values in this map */
public java.util.Set values();
/** Define an inner class for Entry */
public static class Entry {
K key;
V value;
public Entry(K key, V value){
this.key = key;
this.value = value;
}
public K getKey(){
return key;
}
public V getValue(){
return value;
}
@Override
public String toString(){
return "["+ key +","+ value +"]";
}
}
}
image text in transcribed

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

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago