diff --git a/java/06_linkedlist/SinglyLinkedList.java b/java/06_linkedlist/SinglyLinkedList.java index c6d36e2f..1a8b0f87 100644 --- a/java/06_linkedlist/SinglyLinkedList.java +++ b/java/06_linkedlist/SinglyLinkedList.java @@ -301,6 +301,7 @@ public int getData() { return data; } } + public static void main(String[]args){ SinglyLinkedList link = new SinglyLinkedList(); diff --git a/java/07_linkedlist/LinkedListAlgo.java b/java/07_linkedlist/LinkedListAlgo.java index 7b2d0f24..be25d80d 100644 --- a/java/07_linkedlist/LinkedListAlgo.java +++ b/java/07_linkedlist/LinkedListAlgo.java @@ -144,7 +144,7 @@ public static Node findMiddleNode(Node list) { Node fast = list; Node slow = list; - while (fast.next != null && fast.next.next != null) { + while (fast != null && fast.next != null) { fast = fast.next.next; slow = slow.next; }