package zuochengyun.chapter2;
public class Plalindrome {
public static boolean getPlalindrome(Node head) {
Node node1=head;
int length=0;
while(node1!=null){
length++;
node1=node1.next;
}
int from=1;
int to=length;
if(length%2==0)
from=length/2+2;
else
from=length/2+1;
node1=head;
int n=0;
while(n!=from){
node1=node1.next;
n++;
}
Node head2=ReverseList.reverseList(node1);
while(head2!=null){
if(head.value==head2.value){
head=head.next;
head2=head2.next;
}
else return false;
}
return true;
}
}