Skip to content

Commit

Permalink
adding last to the element in the linked list
Browse files Browse the repository at this point in the history
  • Loading branch information
suhanigupta23 authored Sep 8, 2024
1 parent bd74eb2 commit b35d25d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion add_last_to_linked_list.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ void addList(int val){
Node temp=new Node();
temp.data=val;
temp.next=null;
size++;
if(size==0){
head=tail=temp;
}
else{
tail.next=temp;
tail=temp;
}
size++;
}
}
}

0 comments on commit b35d25d

Please sign in to comment.