logo Practice-It logo

BJP3 Exercise 16.21: reverse

Related Links:
Author: Whitaker Brand (on 2013/04/01)

Write a method reverse that reverses the order of the elements in the list. For example, if the variable list initially stores this sequence of integers:

[1, 8, 19, 4, 17]

It should store the following sequence of integers after reverse is called:

[17, 4, 19, 8, 1]

Assume that you are adding this method to the LinkedIntList class as defined below:

public class LinkedIntList {
    private ListNode front;   // null for an empty list
Type your solution here:

This is a partial class problem. Submit code that will become part of an existing Java class as described. You do not need to write the complete class, just the portion described in the problem.

You must log in before you can solve this problem.

Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.