In Java: Modify the attached program code below According to the question a, b and c a. Replace the appendNode() method by an insertNode() method which inserts the new node in such a way to keep the list always sorted in increasing order. b. Add a recursive method displayReverse() which displays the list in reverse order. c. Do the needed changes to the main()in order to reflect the above two changes.
In Java: Modify the attached program code below According to the question a, b and c
a. Replace the appendNode() method by an insertNode() method which inserts the new node in such a way to keep the list always sorted in increasing order.
b. Add a recursive method displayReverse() which displays the list in reverse order.
c. Do the needed changes to the main()in order to reflect the above two changes.
public class DoublyLinkedList { public void addNode(String item) { |
import java.util.Scanner; public class LinkedListsExample { public static void main(String[] args) { |
public class Node { String element; Node prev; Node next; public Node(String newElement) { element = newElement; prev = next = null; } } |
Trending now
This is a popular solution!
Step by step
Solved in 2 steps