crack the code interview 2.5

Given a circular linked list, implement an algorithm which returns node at the begin-
ning 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

So, we now know the following:

1. Head is k nodes from LoopStart (by definition).

2. MeetingPoint for n1 and n2 is k nodes from LoopStart (as shown above).

struct LinkNode
{
int value;
}

{
return NULL;

if (slow == NULL)
return NULL;
while (fast != slow)
{
fast = fast->next;
if (fast == NULL)
return NULL;
fast = fast->next;
slow = slow->next;
}
while (start != slow)
{
start = start->next;
slow = slow->next;
}
return fast;
}

cracking the code interview——c++实现

2016-07-09 09:03:53

Cracking the Coding Interview 6th 第6版 高清完整版PDF

2016年06月18日 53.45MB 下载

cracking the coding interview 中文版 （程序员面试金典）

2014-10-19 11:32:00

笔记摘录——Cracking the code interview

2014-11-12 23:42:47

Cracking the code interview总结

2016-04-14 14:09:30

Cracking the coding interview---中文解析版

2014-09-24 14:58:16

经典算法题目：Cracking the coding interview 问题与解答

2016-10-31 00:39:47

crack over the code interview

2013年10月17日 2.05MB 下载

[程序员面试金典] 英文原版非扫描版 Cracking the Coding Interview(6th) 189道问题和答案

2018年02月08日 81.29MB 下载

Cracking the coding interview（原版）

2014-07-01 11:51:19

不良信息举报

crack the code interview 2.5