Question
Recall the remove method of a single linked list. Here is an alternative remove method for the SLinkedListRec class which removes the node having the
Recall the remove method of a single linked list. Here is an alternative remove method for the SLinkedListRec class which removes the node having the first occurrence of data from a single linked list. The method calls a recursive helper method removeRec which does most of the work.
Find uploaded the SLinkedListRec class. Implement and append the remove method and the helper method removeRec defined below to the SLinkedListRec class.
private boolean removeRec(Node cur, Node prev, E outData) {
}
public boolean remove(E data){
}
Write a tester class that tests the remove method, as well as size(), toString(), replace(), and add() methods implemented in class.
For testing purposes, we will unify the class E. Consider E to be a class called Team. The Team class
should have the following attributes and methods:
private attribute: name of type String, representing the Teams name.
private attribute: country of type String, representing the country of the Team.
a constructor that takes the name and country as parameters
getters and setters
toString method of the format: Team_name, TeamCountry. Example: PSG, France
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