See More

import java.util.LinkedList; public class HashTable { public static final int ARR_SIZE = 8; public LinkedList[] arr = new LinkedList[ARR_SIZE]; //hash function public int getIndexBelowMaxForKey(String str, int max) { int hash = 0; for (int i = 0; i < str.length(); i++) { hash = (hash << 5) + hash + str.charAt(i); hash = hash & hash; // Convert to 32bit integer hash = Math.abs(hash); } return hash % max; } public static class Bucket { //your code is here } public void insert (String key, String value) { //your code is here int index = getIndexBelowMaxForKey(key, ARR_SIZE); } public String retrieve(String key) { // your code is here int index = getIndexBelowMaxForKey(key, ARR_SIZE); } public void remove (String key) { //your code is here int index = getIndexBelowMaxForKey(key, ARR_SIZE); } }