求中间结点

This commit is contained in:
Bryanlby 2019-08-08 16:32:39 +08:00
parent 31b0908077
commit e1347e4bf1
2 changed files with 2 additions and 1 deletions

View File

@ -301,6 +301,7 @@ public class SinglyLinkedList {
return data;
}
}
public static void main(String[]args){
SinglyLinkedList link = new SinglyLinkedList();

View File

@ -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;
}