Consider the following implementation of double linked list class.
public class DLIST {static class Node{private E data, Node next, Node prev;private Node(E dataItem, Node nextnode, Node prevnode){ // constructor data = dataItem;next = nextnode;prev = prevnode}private Node(E dataItem) { //constructordata = dataItem;next = null; prev=null; } }private Node head=null;private Node tail=null; //initialisation }a) Write a Java method that prints 1st, 3rd, 5th, etc. nodes in the double linked list.b) Write a java method to display the double linked list in the reverse order.
static class Node{private E data, Node next, Node prev;private Node(E dataItem, Node nextnode, Node prevnode){ // constructor data = dataItem;next = nextnode;prev = prevnode}private Node(E dataItem) { //constructordata = dataItem;next = null; prev=null; } }private Node head=null;private Node tail=null; //initialisation }a) Write a Java method that prints 1st, 3rd, 5th, etc. nodes in the double linked list.b) Write a java method to display the double linked list in the reverse order.
private E data, Node next, Node prev;private Node(E dataItem, Node nextnode, Node prevnode){ // constructor data = dataItem;next = nextnode;prev = prevnode}private Node(E dataItem) { //constructordata = dataItem;next = null; prev=null; } }private Node head=null;private Node tail=null; //initialisation }a) Write a Java method that prints 1st, 3rd, 5th, etc. nodes in the double linked list.b) Write a java method to display the double linked list in the reverse order.
private Node(E dataItem, Node nextnode, Node prevnode){ // constructor data = dataItem;next = nextnode;prev = prevnode}private Node(E dataItem) { //constructordata = dataItem;next = null; prev=null; } }private Node head=null;private Node tail=null; //initialisation }a) Write a Java method that prints 1st, 3rd, 5th, etc. nodes in the double linked list.b) Write a java method to display the double linked list in the reverse order.
data = dataItem;
next = nextnode;
prev = prevnode
}
private Node(E dataItem) { //constructor
next = null; prev=null;
private Node head=null;private Node tail=null; //initialisation }a) Write a Java method that prints 1st, 3rd, 5th, etc. nodes in the double linked list.b) Write a java method to display the double linked list in the reverse order.
private Node tail=null; //initialisation }a) Write a Java method that prints 1st, 3rd, 5th, etc. nodes in the double linked list.b) Write a java method to display the double linked list in the reverse order.
a) Write a Java method that prints 1st, 3rd, 5th, etc. nodes in the double linked list.
b) Write a java method to display the double linked list in the reverse order.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here