Text: JAVA adding to linkedNodes
Please give just bare code as asked (no need for full code or method)
OBJP5 Self-Check 16.10: linkedNodes10
Language/Type: Java ListNodes LinkedLists
Related Links: LinkedListJava
Author: Marty Stepp on 2019/09/19)
Write the code necessary to convert the following sequence of ListNode objects
list -> [1] -> [2] /
Into this sequence of ListNode objects
list -> [3] -> [1] -> [2] /
Assume that you are using ListNode class as defined in the textbook
public class ListNode {
public int data; // data stored in this node
public ListNode next; // a link to the next node in the list
public ListNode() { ... }
public ListNode(int data) { ... }
public ListNode(int data, ListNode next) { ... }
}
Type your solution here:
This problem asks for bare code. Submit a fragment of Java code as described. Do not write any class or method heading around your code, just write the lines of code that will produce the result described.
Indent
Sound F/X Highlighting
Submit