@@ -0,0 +1,1830 @@
+import java.io.*; %0A%0A// Java program to implement %0A// a Singly Linked List %0Apublic class LinkedList %7B %0A%0A%09Node head; // head of list %0A%0A%09// Linked list Node. %0A%09// This inner class is made static %0A%09// so that main() can access it %0A%09static class Node %7B %0A%0A%09%09int data; %0A%09%09Node next; %0A%0A%09%09// Constructor %0A%09%09Node(int d) %0A%09%09%7B %0A%09%09%09data = d; %0A%09%09%09next = null; %0A%09%09%7D %0A%09%7D %0A%0A%09// Method to insert a new node %0A%09public static LinkedList insert(LinkedList list, int data) %0A%09%7B %0A%09%09// Create a new node with given data %0A%09%09Node new_node = new Node(data); %0A%09%09new_node.next = null; %0A%0A%09%09// If the Linked List is empty, %0A%09%09// then make the new node as head %0A%09%09if (list.head == null) %7B %0A%09%09%09list.head = new_node; %0A%09%09%7D %0A%09%09else %7B %0A%09%09%09// Else traverse till the last node %0A%09%09%09// and insert the new_node there %0A%09%09%09Node last = list.head; %0A%09%09%09while (last.next != null) %7B %0A%09%09%09%09last = last.next; %0A%09%09%09%7D %0A%0A%09%09%09// Insert the new_node at last node %0A%09%09%09last.next = new_node; %0A%09%09%7D %0A%0A%09%09// Return the list by head %0A%09%09return list; %0A%09%7D %0A%0A%09// Method to print the LinkedList. %0A%09public static void printList(LinkedList list) %0A%09%7B %0A%09%09Node currNode = list.head; %0A%0A%09%09System.out.print(%22LinkedList: %22); %0A%0A%09%09// Traverse through the LinkedList %0A%09%09while (currNode != null) %7B %0A%09%09%09// Print the data at current node %0A%09%09%09System.out.print(currNode.data + %22 %22); %0A%0A%09%09%09// Go to next node %0A%09%09%09currNode = currNode.next; %0A%09%09%7D %0A%09%7D %0A%0A%09// Driver code %0A%09public static void main(String%5B%5D args) %0A%09%7B %0A%09%09/* Start with the empty list. */%0A%09%09LinkedList list = new LinkedList(); %0A%0A%09%09// %0A%09%09// ******INSERTION****** %0A%09%09// %0A%0A%09%09// Insert the values %0A%09%09list = insert(list, 1); %0A%09%09list = insert(list, 2); %0A%09%09list = insert(list, 3); %0A%09%09list = insert(list, 4); %0A%09%09list = insert(list, 5); %0A%09%09list = insert(list, 6); %0A%09%09list = insert(list, 7); %0A%09%09list = insert(list, 8); %0A%0A%09%09// Print the LinkedList %0A%09%09printList(list); %0A%09%7D %0A%7D %0A

Create linkedlist.java