Skip to content

Commit 45eb750

Browse files
authored
Updated LL.java
slight modification in deleteLast() and delete().
1 parent ebada45 commit 45eb750

File tree

1 file changed

+2
-1
lines changed
  • lectures/18-linkedlist/code/src/com/kunal

1 file changed

+2
-1
lines changed

lectures/18-linkedlist/code/src/com/kunal/LL.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public int deleteLast() {
7878
int val = tail.value;
7979
tail = secondLast;
8080
tail.next = null;
81+
size--;
8182
return val;
8283
}
8384

@@ -93,7 +94,7 @@ public int delete(int index) {
9394
int val = prev.next.value;
9495

9596
prev.next = prev.next.next;
96-
97+
size--;
9798
return val;
9899
}
99100

0 commit comments

Comments
 (0)