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

In java:

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 ... }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!