Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using only the public interface of the linked list class, write a method public static void reverse(LinkedList staff) that reverses the entries in a linked
Using only the public interface of the linked list class, write a method public static void reverse(LinkedList
You need to supply the following class in your solution:
ListUtil
Use the following class as your tester class - DO NOT MODIFY THE BELOW CLASS!
import java.util.LinkedList; import java.util.ListIterator; /** A test program to reverse the entries in a linked list. */ public class ReverseTester { public static void main(String[] args) { LinkedListnames = new LinkedList (); names.addLast("Dick"); names.addLast("Harry"); names.addLast("Romeo"); names.addLast("Tom"); ListUtil.reverse(names); System.out.println(names); System.out.println("Expected: [Tom, Romeo, Harry, Dick]"); } }
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