Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Introduction: In this project you will add methods to an existing linked list class. Description: Modify the author's MyLinkedList class to add the following methods.
Introduction: In this project you will add methods to an existing linked list class. Description: Modify the author's "MyLinkedList" class to add the following methods. Perform checking of the parameters and throw exceptions where appropriate. 15 points each (a-e) a. SWap receives two index positions as parameters and swaps the two nodes (the nodes, not just the values inside) at these positions, provided both positions are within the current size D. reverse returns a new MyLinkedList that has the elements in reverse order. C. erase receives an index position and number of elements as parameters, and removes elements beginning at the index position for the number of elements specified, provided the index position is within the size and together with the number of elements does not exceed the size d. insertList receives a List and an index position as parameters, and copies all of the passed list into the existing list at the position specified by the parameter, provided the index position does not exceed the size e. shift receives an integer and shifts the list this many nodes forward or backward for example, if passed 2, the first two nodes move to the tail, or if passed -3, the last three nodes move to the front. +2: abcde -> cdeab -3 abcde - cdeab 25 points f. main add code to the main method to demonstrate each of your methods
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