Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ * * * Your implementation of a ExternalChainingHashMap. * / public class ExternalChainingHashMap { / * * The initial capacity of the ExternalChainingHashMap when

/**
* Your implementation of a ExternalChainingHashMap.
*/
public class ExternalChainingHashMap {
/*
* The initial capacity of the ExternalChainingHashMap when created with the
* default constructor.
*
* DO NOT MODIFY THIS VARIABLE!
*/
public static final int INITIAL_CAPACITY =13;
/*
* The max load factor of the ExternalChainingHashMap.
*
* DO NOT MODIFY THIS VARIABLE!
*/
public static final double MAX_LOAD_FACTOR =0.67;
/*
* Do not add new instance variables or modify existing ones.
*/
private ExternalChainingMapEntry[] table;
private int size;
/**
* Constructs a new ExternalChainingHashMap with an initial capacity of INITIAL_CAPACITY.
*/
public ExternalChainingHashMap(){
//DO NOT MODIFY THIS METHOD!
table =(ExternalChainingMapEntry[]) new ExternalChainingMapEntry[INITIAL_CAPACITY];
}
/**
* Returns whether or not the key is in the map.
*
* @param key The key to search for in the map. You may assume that the
* key is never null.
* @return true if the key is contained within the map, false otherwise.
*/
public boolean containsKey(K key){
// WRITE YOUR CODE HERE (DO NOT MODIFY METHOD HEADER)!
}
/**
* Returns the table of the map.
*
* For grading purposes only. You shouldn't need to use this method since
* you have direct access to the variable.
*
* @return The table of the map.
*/
public ExternalChainingMapEntry[] getTable(){
// DO NOT MODIFY THIS METHOD!
return table;
}
/**
* Returns the size of the map.
*
* For grading purposes only. You shouldn't need to use this method since
* you have direct access to the variable.
*
* @return The size of the map.
*/
public int size(){
// DO NOT MODIFY THIS METHOD!
return size;
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions