Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

These two files, MyHashEntry.java and MyHashTable.java, must be implemented within the given design. cannot change the name of public methods. Please notice that the table

These two files, MyHashEntry.java and MyHashTable.java, must be implemented within the given design. cannot change the name of public methods. Please notice that the table must be implemented as generic data structure.

/** * class MyHashEntry. A Hash Entry as a single linked list Node * * @author Hongbiao Zeng * @version Dec 11, 2015 */ public class MyHashEntry , V> { private K key; private V value; MyHashEntry next; /** * Constructor * @param key The key of MyHashEntry * @param value The value of myHashEntry */ public MyHashEntry(K key, V value){ } /** * get the key * @return the key of the ordered pair */ public K getKey(){ } /** * set the key for this ordered pair * @param key The key for this ordered pair */ public void setKey(K key){ } /** * get the value of this ordered pair * @return the value of this ordered pair */ public V getValue(){ } /** * set the value of this ordered pair * @param value the new value of this ordered pair */ public void setValue(V value){ } /** * set next entry for this entry * @param next A reference to the next entry */ public void setNext(MyHashEntry next){ } /** * get next entry * @return a reference to the next entry */ public MyHashEntry getNext(){ } }

/** * class MyHashTable. A simple HashTable. Handle collision by chain * * @author Hongbiao Zeng * @version Nov 27, 2015 */ import java.util.ArrayList; public class MyHashTable, V> { private ArrayList> table; private int count; // how many elements in table /** * Constructor. Constructor an empty MyHashTable with given number of Buckets * @param tableSize The number of Buckets of the table */ public MyHashTable(int tableSize){ } /** * constructor. Construct an empty MyHashTable with capacity 10 buckets */ public MyHashTable(){ } /** * get the number of elements in the table * @return the number of elements in the table */ public int size(){ } /** * clear the table */ public void clear(){ } /** * get the value with given key. * @param key The given key * @return the value that have the key matches the given key. If no such a value, return null */ public V get(K key){ } /** * insert (key, value) pair into the table * @param key The key of the pair * @param value The value of the pair */ public void insert(K key, V value){ } /** * remove the value with given key from the table * @param key The given key * @return the value whose key matches the given key. If no such value, null is returned */ public V remove(K key){ } /** * check if the table is empty,i.e. no entry * @return true if the table holds no elements; false otherwise */ public boolean isEmpty(){ } /** * return a String representation of the table * @return a String representation of the table */ public String toString(){ } }

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

More Books

Students also viewed these Databases questions