Question
//It's implemented in java!!!!! public class HashLinkedList{ /* * Fields */ private HashNode head; private Integer size; /* * Constructor */ HashLinkedList(){ head = null;
//It's implemented in java!!!!!
public class HashLinkedList{ /* * Fields */ private HashNode head;
private Integer size;
/* * Constructor */
HashLinkedList(){ head = null; size = 0; }
/* *Add (Hash)node at the front of the linked list */
public void add(K key, V value){ // ADD CODE BELOW HERE
// ADD CODE ABOVE HERE }
/* * Get Hash(node) by key * returns the node with key */
public HashNode getListNode(K key){ // ADD CODE BELOW HERE
// ADD CODE ABOVE HERE }
/* * Remove the head node of the list * Note: Used by remove method and next method of hash table Iterator */
public HashNode removeFirst(){ // ADD CODE BELOW HERE
// ADD CODE ABOVE HERE return null; //CODE STUB.. REMOVE THIS LINE }
/* * Remove Node by key from linked list */
public HashNode remove(K key){ // ADD CODE BELOW HERE
// ADD CODE ABOVE HERE return null; // removing failed }
/* * Delete the whole linked list */ public void clear(){ head = null; size = 0; } /* * Check if the list is empty */
boolean isEmpty(){ return size == 0? true:false; }
int size(){ return this.size; }
//ADD YOUR HELPER METHODS BELOW THIS
//ADD YOUR HELPER METHODS ABOVE THIS
}
Implement HashLinkedList, which is a simple version of the singly linked list class for the buckets of the hash table. You can start from the linked list implementation provided on the course web site (Exercises 3) as a guide. In particular, implement the methods add(K, V), remove(K), removeFirstOI, getListNode (K)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started