We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e9064ba + 34aef89 commit d198578Copy full SHA for d198578
lectures/18-linkedlist/code/src/com/kunal/CLL.java
@@ -28,7 +28,9 @@ public void display() {
28
if (head != null) {
29
do {
30
System.out.print(node.val + " -> ");
31
- node = node.next;
+ if (node.next != null) {
32
+ node = node.next;
33
+ }
34
} while (node != head);
35
}
36
System.out.println("HEAD");
0 commit comments