微软最新的一道笔试题,我觉的出的不好,要改的地方太多了
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;
}
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;
}
相关文章推荐
- 数位DP--由一道微软笔试题引起
- 一道微软的Mini-Test笔试题(二)
- 一道微软笔试题,算法才是王道
- C语言测试题目解答:微软一道笔试题,2005年华为招聘
- 微软的一道C语言笔试题(转)
- 一道网上找的微软笔试题
- 一道微软MiniTest笔试题
- 一道微软笔试题
- 一道微软的Mini-Test笔试题 解决方法。
- 送上今年微软的一道笔试题
- 微软一道笔试题目
- 赴微软测试工程师必考一道笔试题目
- 微软的一道笔试编程试题
- 一道微软的Mini-Test笔试题(一)
- 一道微软笔试题: 4个袋子,15个球,每个袋子至少放一个球,而且袋子中的球数量不能重复,有多少种方式
- 一道微软笔试题
- 送上今年微软的一道笔试题
- 一道微软笔试题
- 下载微软软件的地方 (http://msdn.itellyou.cn/)