Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

if we have following List classes: public class LinkedList<T> { class ListNode {

ID: 3718865 • Letter: I

Question

if we have following List classes:

public class LinkedList<T> {

class ListNode {

protected T value;

protected ListNode next;

public ListNode(T val, ListNode nxt) {

value = val;

next = nxt;

}

public ListNode(T val) {

this(val, null);

}

public ListNode() {

this(null, null);

}

}

can you write the folowing methods in java:

1.Write a method boolean equals(LinkedList lhs, LinkedList rhs) that uses two ListIterators to check for deep equality of lists lhs and rhs. This code should NOT be part of the ListIterator class.

2. Write a recursive method void printReverse(Node node) which prints the values in the list referenced by node in reverse. You may assume that node references a valid node in the list, i.e. not the dummy header node. HINT: this method should only be 3 or 4 lines long.

Explanation / Answer

Please find my implementation of both methods.