利用双指针
void printLinkedListInReverse(struct ImmutableListNode* head) {
if (NULL == head) return;
struct ImmutableListNode *slow;
struct ImmutableListNode *fast;
struct ImmutableListNode *fast_head = head->getNext(head);
while (fast_head) {
slow = head;
fast = fast_head;
while(fast) {
slow = slow->getNext(slow);
fast = fast->getNext(fast);
}
slow->printValue(slow);
fast_head = fast_head->getNext(fast_head);
}
slow = head;
slow->printValue(slow);
return;
}