java 1. Hybrid Linked List / Separate Chaining Hash Table Create a hybrid linked
ID: 3689975 • Letter: J
Question
java
1. Hybrid Linked List / Separate Chaining Hash Table
Create a hybrid linked list and use random numbers between 10 -99 for input.
Methods - search ()/sort (), set ()/get (), add ()/remove ()
INCLUDE Sort/search algorithms
Analysis of Time for n= 100 n = 1000, n = 10000
Explanation / Answer
public class createaSeparateChainingHashTable { /* This is used to construct the separate chaining hash table. */ public createSeparateChainingHashTable( ) { this( DEFAULT_TABLE_SIZE ); } /* now we will construct the hash table with the arguement-> sizehere which will be the approximate table size using the constructor here */ @SuppressWarnings("unchecked") public createaSeparateChainingHashTable( int sizehere ) { theLists = new LinkedList[ nextPrime( sizehere ) ]; for( int i = 0; i theLists.length ) rehashfunction( ); } } /** This function is used to remove from the hash table. Parameter x is the item to be removed. */ public void removehashtable( int x ) { List whichListone = theLists[ myhashfunction( x ) ]; if( whichListone.containshere( x ) ) { whichListone.removehastable( x ); currentSize--; } } /* This function is used to find an item in the hash table. parameter x is the item to be search for.This will return true if x is not found. */ public boolean containshere( int x ) { List whichListone = theLists[ myhashfunction( x ) ]; return whichListone.containshere( x ); } /*This function is used to make the hash table logically empty. */ public void makeEmpty( ) { for( int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.