Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

Java代写 | DataStructure Linked List

Java代写 | DataStructure Linked List

Playing with Linked List
In this question, you will complete all the methods (that have a TODO) inside the class
We have also provided to you that contains a main function with test cases inside
it. All the methods that you are required to complete have comments that will help you get started. Do not
make head as private in your code1, as it will break our test cases. In the starter code provided head is
public. Note that your code will be graded not only for function, but also for form (this includes formatting,
sensible variable names, sensible algorithms used, no special cases when the general works, etc.).
Symbol Table
For this problem, you are going to write a program which stores variables (just Strings)
and associated values (of a generic type); such a data structure is used in all programming languages during
compilation (e.g., Java) or interpretation (e.g., Python) to store information associated with variables. The
SymbolTable class will be generic in that it can store any kind of object as values (in the unit test, we will
create two different symbol tables, one holding Integers and one holding Strings). The data structure used
to store the variables and values will be a linked list created from the following Node class:
private class Node { // Node class for LLs
String variable;
Value value;
Node next;
public Node(String k, Value v, Node p) { // Constructor
variable = k; value = v; next = p;
Node head = null;
This class will be an inner class” of the SymbolTable class, that is, a class de ned inside another class,
and all the information about the linked list will be private. Here is a template to get you started: The linked list will be kept in ascending lexicographic order, (you will use compareTo(…)
to compare the Strings when doing insertion). Note that the ordering used is the same as in a dictionary,
and in fact, a symbol table IS a dictionary, where the meaning” of a symbol is the value associated with
each variable name.
You may NOT use loops to process the linked lists, and hence you will have to write recursive algorithms
for those methods that require moving down the linked list. The only loops that will occur in your program
will be those that I wrote in the Unit Tests.
The interface for the symbol table is as follows (cut and paste into a new interface in your hw7 src
The template code contains the class, the basic Node de nition, a toString() method,
stubs for all the methods, and also a unit test which will be used to grade your submission. Please read
carefully my comments about the iterator code. In order to make this compile, so you could use step-wise
re nement, I have had to comment out various parts of the class. It should be clear what to do. Here is a
picture highlighting the various methods and how they work