Question: Consider the following code for a LinkedList: ( CLO - 2 , CLO - 3 , CLO - 4 , CLO - 5 ) public
Consider the following code for a LinkedList: CLO CLO CLO CLOpublic class LinkedList protected Node head null;public void add int data Code toalways add the node at the head of the listclass Node l int data;Node next null;public Node int datathisdata data;Below write a class Sortedlinked ist that extends the class above and overrides the add method so when new data is added to the Sorted Linked List the nodes are always added in sorted order. You may write code you would add to the Node class provided above, just be sure to note which code would be in the Node class. You may not assume any other methods are present in these classes.
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
