Give the code to add data to the end of a linked list using the above classes and function declaration as given. Make sure you take care of the special case of an empty list.
Code:class Node{ int data; Node next; } class LinkedList{ Node head; public void addToEnd(int d){ // add stuff here } }




Reply With Quote