Question: Problem 1 (60 points) Consider the LinkedList class we discussed in lecture 8 (see the slides). Add the following methods to the class and submit
Problem 1 (60 points) Consider the LinkedList class we discussed in lecture 8 (see the slides). Add the following methods to the class and submit the completed LinkedList class. You should also write a simple main) method to invoke the following methods. e size which returns the size of the linked list as int . getElementByIndex(int index) which returns the Link specified by the index. For example, getElementBylndex(0) should return the first Link, getElementBylndex(2) should return the third Link. If index is not in range, your method should return null. e hasDuplicate0 which returns true if the linked list contains duplicate data, returns false if there is no duplicate data in the list. e reverse which reverses the linked list and returns the new head/first of the linked list (which is of type Link)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
