由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - std::list如何检测环?
相关主题
也发一个 F,L,G 电面问问List
ANY IDEA?How to handle the return type of container.size() in C++
remove a node (and its memory) from a doubly linked list问一道C++ template的面试题
how to judge a linked list is palindrome?发bloomberg面经 [电面,目测已挂,赞人品]
问一题Amazon的LRU设计题
问个题ms面试题
请教iterative merge sort list的代码哪个高手能指出我程序的问题 (20几行的代码)
MS面经。BST to double linked list的code
相关话题的讨论汇总
话题: list话题: std话题: loop话题: hasloop话题: alist
进入JobHunting版参与讨论
1 (共1页)
O******i
发帖数: 269
1
Please implement the loop detection for std::list, like hasLoop(std::list
alist)
如果是普通链表找环,可以用两个指针,一快一慢。能套用到这题么?具体code如何写?
bool hasLoop(std::list alist)
{
blablabla
}
y*******g
发帖数: 6599
2
iterator和指针一样用

写?

【在 O******i 的大作中提到】
: Please implement the loop detection for std::list, like hasLoop(std::list
: alist)
: 如果是普通链表找环,可以用两个指针,一快一慢。能套用到这题么?具体code如何写?
: bool hasLoop(std::list alist)
: {
: blablabla
: }

S**I
发帖数: 15689
3
How could you create a STL list containing a loop?

写?

【在 O******i 的大作中提到】
: Please implement the loop detection for std::list, like hasLoop(std::list
: alist)
: 如果是普通链表找环,可以用两个指针,一快一慢。能套用到这题么?具体code如何写?
: bool hasLoop(std::list alist)
: {
: blablabla
: }

q****x
发帖数: 7404
4
haha, good question.

【在 S**I 的大作中提到】
: How could you create a STL list containing a loop?
:
: 写?

f*******t
发帖数: 7549
5
re

【在 S**I 的大作中提到】
: How could you create a STL list containing a loop?
:
: 写?

y*******g
发帖数: 6599
6
正常的linked list也不会有loop

How could you create a STL list containing a loop?
写?

【在 S**I 的大作中提到】
: How could you create a STL list containing a loop?
:
: 写?

j********x
发帖数: 2330
7
doubly-linked list很好探测环
u**r
发帖数: 663
8
list的iterator能造出loop么?
stl的list里头iterator难道不是单调从list.begin()走到list.end()?

【在 y*******g 的大作中提到】
: iterator和指针一样用
:
: 写?

H****s
发帖数: 247
9
std::list不能有loop而且std::list是doubly linked list, how could a doubly
linked list contains a cycle if the begin() is not equal to end()?
y*******g
发帖数: 6599
10
好像按list的API是弄不出环,想错了

【在 u**r 的大作中提到】
: list的iterator能造出loop么?
: stl的list里头iterator难道不是单调从list.begin()走到list.end()?

a****n
发帖数: 1887
11
都一样的
1 (共1页)
进入JobHunting版参与讨论
相关主题
BST to double linked list的code问一题
贡献几道amazon电面题问个题
Doubly Linked List reverse Why I cann't reverse twice请教iterative merge sort list的代码
为什么我做了快1000道题了,还是不行呢?!MS面经。
也发一个 F,L,G 电面问问List
ANY IDEA?How to handle the return type of container.size() in C++
remove a node (and its memory) from a doubly linked list问一道C++ template的面试题
how to judge a linked list is palindrome?发bloomberg面经 [电面,目测已挂,赞人品]
相关话题的讨论汇总
话题: list话题: std话题: loop话题: hasloop话题: alist