Question: Q6. Given the following Java class for a singly linked list node, a set of methods can be written in implementing a singly linked list

Q6. Given the following Java class for a singly linked list node, a set of methods can be written in implementing a singly linked list structure accessed by a head pointer public class SLNode f private double data,; private SLNode next; a. Draw a graphical representation of a singly-linked list, with a head pointer, containing three nodes Suppose the following methods are available: SLNode (double initData , SLNode ini text) setData (double d). setNext (SLNode ) getData and getNext). Write the following additional methods as described below. Do not check for any pre-conditions b. input: p, head pointer of a singly-1inked list // postcondition: The number of nodes in the 1inked // list has been returned; the list is unchanged public int size (SLNode p) c.// input: p, head pointer of a singly-1inked list d, data to be added to the list // postcondition: A new node containing d, the given // data, has bee added at the head of the linked list public void addFirst (SLNode p, double d) t
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
