Hello i am taking a comp sci inro course and i was wondering if anyone here could help me?
Here are the questions i am currently trying to answer.
Complete the following method that determines if two chains of nodes are equal, that is, they have the same strings in the same order. Note two empty chains are considered equal. public static boolean equals(Listnode<String> chain1, Listnode<String> chain2) {
Assume the LinkedList class uses a header node with null data. Complete the method below to be added to theLinkedListIterator class. This method inserts item after the node currently pointed to by the iterator. (You may assume that the LinkedList class determines its size by using a loop to count the number of nodes in the chain rather than usingnumItems.) If the item is null the method throws a NoSuchElementException. public class LinkedListIterator<E> implements Iterator<E> { private Listnode<E> curr; public void insertAfter(E item) { Assume you want to maintain a LinkedList containing Integers sorted in increasing order. Complete the methodaddInOrder(Integer i) that adds an Integer to a list that is kept sorted. Implement this method to insert the Integer using a LinkedListIterator and insertAfter(...), which you should assume works as described in the previous question. If you need to insert at the beginning of the list, you may use list.add(0, item). public class SortedIntegerList { private LinkedList<Integer> list; public void addInOrder(Integer i) {
Question 1 is giving me problems because i do not understand how i am supposed to compare the two chains of nodes without being able to use a reference for each of the strings in each chain, like you can when comparing arrays.
Any help would be greatly appreciated
Thank you
i reposted this in another different forum, the homework help forum. I Didn't notice it until after i posted this