Write the following using Java. Create a doubly linked list whose nodes contain
ID: 3804135 • Letter: W
Question
Write the following using Java.
Create a doubly linked list whose nodes contain Strings. Your list should include the following methods:
• Insert a node in the list in alphabetical order
• Find a node that matches a String
• Traverse the list forwards and print
• Traverse the list backwards and print
• Delete a node from the list
• Delete/destroy the list
In addition to creating the class(es) for your linked list, you’ll need to create a main method that thoroughly tests each function you build to show that it works.
Explanation / Answer
import java.util.*;
class Node { private String value;
private Node back;
private Node next;
public String getValue(){ return value;
}
public Node getBack(){ return back;
}
public Node getNext()
{
return next;
}
public void setValue(String val)
{
value
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.