由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - C++ Q62: loop in a linked list (Bloomberg)
相关主题
C++ 面试题目分享(1)如何删除 linked list 的最后一个元素 (转载)
请教一个C++的小问题: Node *&curr Vs Node *curr请教Bloomberg online assesment
How can one determine whether a singly linked list has a cycle?BB电面
问一题copy link with random additional pointers
[电话面试] Amazon First Round问道题,binary tree里有一个有indegree 2
两个面试题目讨论一下phone interview program with a small startup
sorted linked list里insert一个node微软面经
remove a node (and its memory) from a doubly linked listFacebook 2 轮电面面经 + 为第三轮求福
相关话题的讨论汇总
话题: loop话题: linked话题: q62话题: bloomberg话题: c++
进入JobHunting版参与讨论
1 (共1页)
c**********e
发帖数: 2007
1
Find whether there is a loop in a linked list. Do you have other ways
instead of using a quick pointer and a slow pointer?
The problem was discussed, but no solution is found. Anybody has an idea?
Original source:
http://www.mitbbs.com/article_t/JobHunting/31529203.html
f**********w
发帖数: 93
2
loop in linked lisk的根本是两个节点的next指向同一个节点,可以作一个hash_map<
Node, reinterpret_castnext()〉, 对linked list 遍历,看有没有
两个next pointer指向同一个Node
h**k
发帖数: 3368
3
你这个算法需要O(n)的additional storage.
详细讨论见http://ostermiller.org/find_loop_singly_linked_list.htmlhttp://en.wikipedia.org/wiki/Cycle_detection
这个问题还要注意另外两个扩展,在知道有loop后,如何找到loop的起点和长度;或者
如何证明你的算法是对的。

map<

【在 f**********w 的大作中提到】
: loop in linked lisk的根本是两个节点的next指向同一个节点,可以作一个hash_map<
: Node, reinterpret_castnext()〉, 对linked list 遍历,看有没有
: 两个next pointer指向同一个Node

1 (共1页)
进入JobHunting版参与讨论
相关主题
Facebook 2 轮电面面经 + 为第三轮求福[电话面试] Amazon First Round
Amazon offer 选择 附面经两个面试题目讨论一下
alternative solution to detect cycle in linked listsorted linked list里insert一个node
有人了解FireEye online test吗?remove a node (and its memory) from a doubly linked list
C++ 面试题目分享(1)如何删除 linked list 的最后一个元素 (转载)
请教一个C++的小问题: Node *&curr Vs Node *curr请教Bloomberg online assesment
How can one determine whether a singly linked list has a cycle?BB电面
问一题copy link with random additional pointers
相关话题的讨论汇总
话题: loop话题: linked话题: q62话题: bloomberg话题: c++