Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The methods below COMP182: Methods that you have to write are the methods i need You are not to use any other java classes than

The methods below "COMP182: Methods that you have to write" are the methods i need image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
You are not to use any other java classes than the two classes provided. If you used any other classes on your code, your project will not be graded. MAKE SURE TO COMINET YOUR CODE! The Linked List In this project, you will work with a similar Linkedt ist class that we practiced during the lectures. Few of the methods in COMP182Linkedl ist.java are already implemented and ready to use. Your job is to add more methods to the COMP182L inkedL ist class that you downloaded from Canvas. Once finished, you'll have a pretty good start on a fully. fledged generic linked list class! During the last few lectures, we discussed the generic (parameterization). When you want to create a class that can accept any data type you want, you need to parameterize your solution. In our implementation of LinkedL ist we used T> to denote this. There are a couple of new methods that you will be writing for this project. Some are easy, some are hard. I have provided code that tests most of the methods by calling them from the main method in the file ListTest.java. The test file will only work when you have done all the methods. In COMP182LinkedList.java I have provided the signature (definition and input parameters) for these methods. At this point to make sure you can run the file (COMP182LinkedList. java that you downloaded from Cavas) I have added template values as return types of the methods. For example, if the method returns an int then I added return 0 as the return value. Here are the methods are as follows: Anything getFixst() Anything getLast () void add (Anything value) void addafter ( 1 nt index, Anyehtng value) Anything set(int index, Rnything aewvalue) vold removeAll (Anythang value) lastindex (Anything value ) COMP182LinkedII ateAnythahg elone boolean equala (object o) CoMP182Iinkediist kAny hhatgy aplat () boolean haacycle () Node reveraeliat () Node oddevenLiat () Node deleteDuplicates () boolean isPalindrome () "For the last two methods, you need to add proper testing to ListTest Java blic class COM182LinkedList \{ If the Node class is a inner class used (only) by the LinkedList class class Node \{ private Anything data; Node next; ublic void addFirst(Anything d) \{ public Anything get(int index) \{ if (index = length) \{ System.out. println("Index of " + index + " out of range"); ; return null; \} Node curr = first; for (int i=0;i split() ! return null; \} public boolean hascycle() \{ public boolean hascycle() \{ return true; 3 public Node reverselist() \{ return null; \} public Node oddEvenList() { return null; \} public Node deleteDuplicates () \{ return null; \} public boolean ispalindrome() \{ return true; \}: public static void main(String[] args). \{ II Here you can create some lists (use lists of Strings If to test) and thoroughly test each of your new methods

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions