Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Node{
- int info;
- Node next;
- }
- Node head;
- void insert(int val){
- Node nn = new Node();
- nn.info = val;
- Node cur = head;
- if(cur==null){
- cur = nn;
- }
- else{
- while(cur.next!=null){
- cur = cur.next;
- }
- cur.next = nn;
- }
- }
Add Comment
Please, Sign In to add comment