Question: A doubly linked list (DLL) is a linked list with nodes that point both forward and backward. Here's an example: 3 5 7 1 Here's

A doubly linked list (DLL) is a linked list with nodes that point both forward and backward. Here's an example:

 3 <---> 5 <---> 7 <---> 1 

Here's a DLL node definition:

 public class DLLNode { public String data; public DLLNode prev, next; public DLLNode(String data, DLLNode next, DLLNode prev) { this.data = data; this.next = next; this.prev = prev; } } 

The next of the last node will be null, and the prev of the first node will be null.

implement a method to reverse the sequence of items in a DLL. Your code should NOT create any new nodes - it should simply resequence the original nodes. The method should return the front of the resulting list.

 public static DLLNode reverse(DLLNode front) { /** COMPLETE THIS METHOD **/ } 

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!