Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help fix the CompletedTwoProbeChainHT.java TODO's CompletedTwoProbeChainHT.java import java.util.LinkedList; import java.util.Queue; public class CompletedTwoProbeChainHT implements TwoProbeChainHT { //any constructors must be made public @Override public

Please help fix the CompletedTwoProbeChainHT.java TODO's

CompletedTwoProbeChainHT.java

import java.util.LinkedList; import java.util.Queue;

public class CompletedTwoProbeChainHT implements TwoProbeChainHT {

//any constructors must be made public

@Override public int hash(Key key) { //TODO return 0; }

@Override public int hash2(Key key) { //TODO return 0; }

@Override public void put(Key key, Value val) { //TODO }

@Override public Value get(Key key) { //TODO return null; }

@Override public void delete(Key key) { //TODO }

@Override public boolean contains(Key key) { //TODO return false; }

@Override public boolean isEmpty() { //TODO return false; }

@Override public int size() { //TODO return 0; }

@Override public Iterable keys() { //TODO return null; }

//////////////////////////////////////////////////////////////////////////////////////////////// // THESE METHODS ARE ONLY FOR GRADING AND COME FROM THE TWOPROBECHAINHT INTERFACE.

@Override public int getM() { //TODO. We suggest something like: //return M;

return 0; }

@Override public int getChainSize(int i) { //TODO. We suggest something like: //return entries[i].size();

return 0; } }

TwoProbeChainHT.java

public interface TwoProbeChainHT extends SymbolTable { /** * Returns the length of the internal array. * * @return The length of the internal array. */ public int getM(); /** * Returns the size of the chain at an index in the internal array. For example: if an index is * unused, it will return 0. If two key/value pairs have been added at the index, it will return * 2. * * @param i Array index. * @return Number of entries saved in list at index. */ public int getChainSize(int i); /** * Computes the hash (will be used as an index) for a key. * * @param key Object to hash. * @return Hash value. */ public int hash(Key key); /** * Computes the alternative hash (will be used as an index) for a key. * * @param key Object to hash. * @return Hash value. */ public int hash2(Key key); }

CODE OUTPUT

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_2

Step: 3

blur-text-image_3

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions