class Insert{ Node first,last,t; static class Node{ int data; Node next; Node(int d){ data = d; next = null; } } void create(int a[], int n){ first = new Node(a[0]); last = first; for(int i=1; iLength(n)){ return; } t = new Node(x); if(index==1){ t.next = first; first = t; } else{ for(int i=2;iLength(n)){ return; } if(index==0){ x = first.data; first =first.next; System.out.println(x); } else{ for(int i=1;i