From e1347e4bf12db64a0fc6234e9367869bc6363157 Mon Sep 17 00:00:00 2001 From: Bryanlby Date: Thu, 8 Aug 2019 16:32:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=82=E4=B8=AD=E9=97=B4=E7=BB=93=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- java/06_linkedlist/SinglyLinkedList.java | 1 + java/07_linkedlist/LinkedListAlgo.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/java/06_linkedlist/SinglyLinkedList.java b/java/06_linkedlist/SinglyLinkedList.java index c6d36e2..1a8b0f8 100644 --- a/java/06_linkedlist/SinglyLinkedList.java +++ b/java/06_linkedlist/SinglyLinkedList.java @@ -301,6 +301,7 @@ public class SinglyLinkedList { 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 7b2d0f2..be25d80 100644 --- a/java/07_linkedlist/LinkedListAlgo.java +++ b/java/07_linkedlist/LinkedListAlgo.java @@ -144,7 +144,7 @@ public class LinkedListAlgo { 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; }