cpp implementation of Linked List Cycle II