Question: I need a Java code with output Please provide both solutions singly linked list and doubly linked list. If your first name starts with a
I need a Java code with output Please provide both solutions singly linked list and doubly linked list.
If your first name starts with a letter from A-J inclusively: Add a method swapTwoNodes to SinglyLinkedList class . This method should swap two nodes node1 and node2 (and not just their contents) given references only to node1 and node2. The new method should check if node1 and node2 are the same node, etc. Write the main method to test the swapTwoNodes method. Hint: You may need to traverse the list.
If your first name starts with a letter from K-Z inclusively: Add a method swapTwoNodes to DoublyLinkedList class . This method should swap two nodes node1 and node2 (and not just their contents) given references only to node1 and node2. The new method should check if node1 and node2 are the same node, etc. Write the main method to test the swapTwoNodes method. Hint: You may need to traverse the list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
