Question
there is llist.java LList.java public class LList { String info; LList nextList; boolean isEmpty() { return(this.nextList == null && this.info == null); } void insert(String
there is llist.java
LList.java
public class LList {
String info;
LList nextList;
boolean isEmpty() {
return(this.nextList == null && this.info == null);
}
void insert(String inInfo) {
if (this.isEmpty()) {
this.info = inInfo;
this.nextList = new LList();
return;
}
this.nextList.insert(this.info);
this.info = inInfo;
}
LList nextList() {
return(this.nextList);
}
int lSize() {
if (this.isEmpty()) {
return(0);
}
return (this.nextList.lSize() + 1); // add one for me
}
void deleteInfo(String inInfo) {
if (this.isEmpty()) {
return;
}
if (this.info != inInfo) {
this.nextList.deleteInfo(inInfo);
} else { // I have the info
this.info = this.nextList.info;
this.nextList.deleteInfo(this.info); // may be null
if (this.info == null) {
this.nextList = null; // I am empty now too.
}
}
return;
}
String travers() {
if (this.isEmpty()) {
return("");
}
return (this.info + ", " + this.nextList.travers()); // don't care about the comma
}
LList findInfo(String inInfo) {
if (this.isEmpty()) {return (null);}
if (this.info == inInfo) { return (this); }
return (this.nextList.findInfo(inInfo));
}
LList cloneLList() {
if (this.isEmpty()) { return (new LList()); }
LList newList = new LList();
newList.nextList = this.nextList.cloneLList();
newList.info = this.info;
return (newList);
}
}
A hash table is a complex object build on top of another object, in this case a linked list. Here is the UML for the hash table: HashTable -key List Array Array +hashToKey(in info String) nt tinsertInfo(in infoToStore String) +findinfo(in infoToFind String) LList deletelnfo(in infoToRemove String) LList info String next LList String His Empty() bool +insertAtHead(in info) LList +next List LList +lSize(): nt +deletelnfo +traverse String The hash table contains an array of linked lists. Each linked list is a folded set of info to be stored in the hash table where a info elements in the list will have the same key value. The array is set to 15 elements in capacity. (NOTE: Both Array and String are Java classes you do not have to implement these.) Here are the story specs for each behavior: Story 1: hashTokey (in info :String) int The input argument is the string of text to be hashed. The function returns an integer value in the range 0..14 by converting the two first characters of the info string into integers, adding them together and then computing the modulo 15. For example, suppose we have "Canada" as the info string. The key will be computed from 'C' and 'a' which are ASCII 67 and 97 respectively. 67+97 1 64, 164 mod 15 314 so the info string "Canada" will be inserted into the LList in index 14 of the array. (HINT: the following statements give the numeric int equivalent of the 'C' in "Canada": String s2 J new String ("Canada"); creates a String object char achar s2.toCharArray()[0]; String object creates an array of char with C in pos 0; System out println (int) achar); output the int cast of the 'C' which is 67
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