Answered step by step
Verified Expert Solution
Link Copied!

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 staff) that reverses the entries in a linked list.

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) { LinkedList names = 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

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions