Guest User

Untitled

a guest
Jan 21st, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. class Node{
  2. int info;
  3. Node next;
  4. }
  5. Node head;
  6.  
  7.  
  8. void insert(int val){
  9. Node nn = new Node();
  10. nn.info = val;
  11. Node cur = head;
  12. if(cur==null){
  13. cur = nn;
  14. }
  15. else{
  16. while(cur.next!=null){
  17. cur = cur.next;
  18. }
  19. cur.next = nn;
  20. }
  21. }
Add Comment
Please, Sign In to add comment