Question: e following class represents a node in a doubly-linked list: class DLLNode ( private Integer data: private DLLNode previ private DLLNode nexti // previous node
e following class represents a node in a doubly-linked list: class DLLNode ( private Integer data: private DLLNode previ private DLLNode nexti // previous node in the list // next node in the list f this.data data;1I ctor f return prev; ) DLLNode(Integer data) Integer getData) DLLNode getPrev() DLLNode getNext) void setPrev (DLLNode prev) void setNext (DLLNode next) // getter // getter // getter return data; return nexti this.prev prev; I setter this.next next; 1/ setter The list class that uses this node class is: class DLList ( private DLLNode head; private DLLNode tail; DLLNode getHead () 1 return head; DLLNode getTail) f return tail; ) Write the following methods for the DLList class. Don't worry about imports or integrity. (10 pts each ) A) void insertBeforeHead (DLLNode n) for the DLList class. B) void appendAfterTail (DLLNode n) for the DLList class. C) int length() returns the number of nodes in the current list. D) public boolean equals (object x) 2 instances are equal if they are the same length, and the nth nodes in each list contain equal data. E) ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
