Hello! Please make sure to read all parts of this document carefully. In this homework assignment, you will be developin

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Hello! Please make sure to read all parts of this document carefully. In this homework assignment, you will be developin

Post by answerhappygod »

Hello! Please make sure to read all parts of this documentcarefully.
In this homework assignment, you will be developing theSingly-Linked LinkedList data structure, which will implement theprovided List interface. In doing so, you will write a variety ofmethods from each.
You will also be creating your own generic Node class that yourLinkedList will use. The provided interface and the classes youcreate will be written using generics such that they could work forany class parameter - you will be facing many of the challengesthat the developers who wrote the java.util.LinkedList class had toconfront, as that class uses generics, too!
List of covered topics:
Solution Description
You will create twoclasses: LinkedList.java and Node.java. TheLinkedList will consist of nodes linked to each other withpointers. LinkedList.java will implement the providedList interface. Using the abstract methods provided in theinterface, you will have to implement these methods and adjustvariables and pointers accordingly. To make these decisions, youshould carefully follow the guidelines and logic as taught inlecture. Your program might function for base cases but not handleedge cases appropriately, so test your codeextensively.
Node.java
Represents the nodes which will make up the LinkedList. This isa generic class! Be sure to reflect the use of generics in theclass declaration.
Variables
Do not create any other instance variables than specified below.Any extra instance variables will result in deductions. Allvariables must follow the rules of encapsulation.
A variable named data
A variable named next
Constructors
Methods
Do not create any other methods than those specified. Any extramethods will result in point deductions. All methods must have theproper visibility to be used where it is specified they areused.
LinkedList.java
Represents a LinkedList comprised of Nodes. This is ageneric class! Be sure to reflect the use of generics in the classdeclaration.
Interface:
Variables
Do not create any other instance variables than specified below.Any extra instance variables will result in deductions. Allvariables must follow the rules of encapsulation.
A variable named head
A variable named tail
A variable named size
Constructors
Methods
Helper methods are discouraged because a proper LinkedListshould not require them. Any extra methods will result in a 5 pointdeduction for code style. All methods must have the propervisibility to be used where it is specified that they are used.
Provided
List.java
An interface representing a List usinggenerics. This is provided to you.
Methods:
The classes that implement List interface must implement thefollowing methods:
Allowed Imports
To prevent trivialization of the assignment, you are onlyallowed to import java.util.NoSuchElementException.
Feature Restrictions
There are a few features and methods in Java that overlysimplify the concepts we are trying to teach or break our autograder. For that reason, do not use any of the following in yourfinal submission:
For List.java use:
/** * Represents the List Abstract Data Type * @author 1331 TA's * @version 1.0 * @param <T> The type of elements in this list */public interface List<T> {
/** * Adds the passed in data to the specifiedindex. * @param data the data to add to theList * @param index the index to add at */ void addAtIndex(T data, int index);
/** * Retrieves the data of the node that'sspecified. * @param index the index of the node whose datawe are retrieving */ T getAtIndex(int index);
/** * Removes the data at the specified index andreturns the data that was removed. * @param index removes the Node at thisindex */ T removeAtIndex(int index);
/** * Removes the Node with the data passed in if aNode containing the data exists. * @param data the data to remove from theList */ T remove(T data);
/** * Clears the LinkedList - garbage collection isyour friend here. * THIS SOLUTION SHOULD CAN BE O(1) */ void clear();
/** * Checks whether the LinkedList is empty ornot. * @return boolean value indicating whether it'sempty or not */ boolean isEmpty();
/** * Returns the size of the List * @return integer size of the list */ int size();
}
LinkedList.java and Node.java start from scratch***
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply