Question: Question 3 Consider the following linked list, where head is the reference to the beginning node. class Node { public String data; / / data
Question
Consider the following linked list, where head is the reference to the beginning node.
class Node
public String data; data in the node
public Node next; reference to the successor
public Node String d
data d;
next null;
class LinkedList
private Node head; reference to the beginning node
public LinkedList
head null;
public void insertAsFirstNodeString d
your code comes here
public void insertAsLastNodeString d
your code comes here
Implement the following two functions. Do NOT use any other helper classobject such as class ReferencePair in ExampleSortedLinkedList.
Points Implement function insertAsFirstNodeString d to insert a new node, whose data field is d as the beginning node of the linked list.
Points Implement function insertAsLastNodeString d to insert a new node, whose data field is d as the ending node of the linked list.
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
