1, use slow and fast pointers ;
* 2. slow move one step , fast move two steps
* 3.fast reach the last node the first reach the central node
* 4. create a new linked list , reverse to save the second half of the list
* 5. compare two lists from begin until second list to end ,
* 6. if the data doens't match , it is not palindrome
use two pointers, slow runner moves one step every time and fast runner moves two steps each time. push the first half of the list into a stack and compare the second half with the pop value of the stack.
【解题思路】Use fast pointer and slow pointer. Put the front half of linked list
into the stack. Then compare the last half of the linked list with the
poped element from the stack.
【gist link] https://github.com/StephenWeiXu/ ... aster/Chap2/2_7.cpp