1. 程式人生 > >[CareerCup] 2.6 Linked List Cycle 單鏈表中的環

[CareerCup] 2.6 Linked List Cycle 單鏈表中的環

2.6 Given a circular linked list, implement an algorithm which returns the node at the beginning of the loop.
DEFINITION
Circular linked list: A (corrupt) linked list in which a node's next pointer points to an earlier node, so as to make a loop in the linked list.
EXAMPLE
Input: A - > B - > C - > D - > E - > C [the same C as earlier]
Output: C