question archive How could I implement these methods for a hash table? boolean contains(DataT item) Returns the if item exists in the hash table
Subject:Computer SciencePrice: Bought3
How could I implement these methods for a hash table?
Method given:
import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; public class MyHashTable<DataType> { private int numBuckets = 10; private ArrayList<DataType>[] buckets; private int count = 0; public MyHashTable() { buckets = new ArrayList[numBuckets]; for (int i = 0; i < numBuckets; i++) { buckets[i] = new ArrayList<DataType>(); } }