您的位置:首页 > 其它

微软最新的一道笔试题,我觉的出的不好,要改的地方太多了

2005-10-17 09:56 435 查看
IsCycleList Check if a singly linked list is a cycle linked list.
If the list is a cycle linked list, the method return the head node of the cycle, or else return null;
please find bug below.

struct pLinkedList
{
pLinkedList* Next;
}

pLinkedList IsCycleList(LinkedList *pHead)
{
pLinkedList* pStart,PCur;
while(pCur!=null)
{
for(;;)
{
if (pStart==pCur->Next)
return pStart;
pStart=pStart->Next;
}
pCur=pCur->Next;
}
return pStart;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: