Cracking the Coding Interview Q2.6

Given a circular linked list, implement an algorithm which returns 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

 

参考:

http://www.cnblogs.com/jdflyfly/p/3829483.html

http://www.cnblogs.com/jdflyfly/p/3829499.html

posted @ 2014-07-08 00:18  jdflyfly  阅读(109)  评论(0编辑  收藏  举报