Professional Documents
Culture Documents
New Microsoft Word Document
New Microsoft Word Document
class Node{
int data;
Node next;
this.data = data;
this.next = null;
if(head == null) {
head = newNode;
tail = newNode;
else {
head = newNode;
head.next = temp;
}
if(head == null) {
System.out.println("List is empty");
return;
while(current != null) {
current = current.next;
System.out.println();
sList.addAtStart(1);
sList.display();
sList.addAtStart(2);
sList.display();
sList.addAtStart(3);
sList.display();
sList.addAtStart(4);
sList.display();