Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//It's implemented in java!!!!! public class HashLinkedList{ /* * Fields */ private HashNode head; private Integer size; /* * Constructor */ HashLinkedList(){ head = null;

image text in transcribed

//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

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

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

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

What is the maximum for SALE_PRICE?

Answered: 1 week ago