Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public void atLast(int new_data)
  2. {
  3. Node new_node=new Node(new_data);
  4. if(head==null)
  5. {
  6. head=new Node(new_data);
  7. return;
  8. }
  9. new_node.next=null;
  10. Node last=head;
  11. while(last.next!=null)
  12. {
  13. last=last.next;
  14. }
  15. last.next=new_node;
  16. return;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement