Question: 4 . 1 . Add a method that findthird ( ) that finds the third node of a doubly linked list by link hopping. You
Add a method that findthird that finds the third node of a doubly linked list by link hopping.
You can assume the list has at least three items.
Your findthird code will be located in DoublyLinkedList.java
Starter code for the findthird method:
Janet McGregor
public E findithivod
Node E chrtentiode headernext;
the rest of your code goes here
return curfentNoderielement;
Test findthird with the following three tests cases. You are welcome to add more, but you must include these.
Sample program output:
Finding the third value of this list:
The third value is:
Finding the third value of this list:
The third value is:
Finding the third value of this list:
Apple "Banana", "Coconut"
The third value is: Coconut
Your code must work for any doublylinked list with enough entries, not just the examples.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
