Professional Documents
Culture Documents
*;
Node()
{
rno=0;
name="";
next=null;
}
void accept()
{
Scanner sc=new Scanner(System.in);
System.out.println(" enter roll no ");
rno=sc.nextInt();
System.out.println(" Enter name ");
name=sc.next();
}
}
first=temp;
first.next=null;
}
void display()
{ System.out.println(rno+ " "+ name);
}
Node createlinkedlist(int n)
{
Node first= new Node();
first.accept();
Node top=first;
for(int i=1;i<n;i++)
{
Node temp=new Node();
temp.accept();
first.next=temp;
first=temp;
}
return top;
}
Node first=top;
int c=0;
while(first!=null)
{ c++;
first.display();
first=first.next;
}
}
case 2:
displaylist(top);
break;
case 1:
top=addtop(top);
break;
case 4:
addbottom(top);
// displaylist(top);
break;
case 5:
deletebottom(top);
case 6:
System.out.println(" exit");
}
}
}
}