由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - how to judge a linked list is palindrome?
相关主题
大家来看看这个CC150的题LC的BST iterator到底要考察什么?
也报个G家intern面经发个servicenow testing职位的面经和offer
facebook实习面经兼求bless请教leetcode高频题是哪些题
leetcode中的binary tree level order traverse II总是有run t问几个有关Binary tree的题
我发现我竟然学会了12种tree traversal的办法转一些我blog上一些常见的二叉树面试问题和总结
an interview question, find mode in a rolling window along data sequence树 inorder下个节点最好办法是啥
(求推荐)recursion以及把recursion转变为iteration的资料攒人品,amazon一面经历
FB 上周2电面考算法可以用stl吗?
相关话题的讨论汇总
话题: linked话题: list话题: palindrome话题: judge话题: traversal
进入JobHunting版参与讨论
1 (共1页)
C**********n
发帖数: 100
1
不是数组,呵呵,
怎么作比较好?把linked list转换成数组再作是不是不符合出题人的意思?
g*******y
发帖数: 1930
2
reverse only half
compare
reverse back
m********0
发帖数: 2717
3
only one traverse?
without knowing the length?

【在 C**********n 的大作中提到】
: 不是数组,呵呵,
: 怎么作比较好?把linked list转换成数组再作是不是不符合出题人的意思?

g*******y
发帖数: 1930
4
one traversal is impossible. Just iterate to the end will take you 1
traversal.
My optimal two and half times of traversal (well, the constant factor for
low-level instructions will be larger than 2.5 for sure)

【在 m********0 的大作中提到】
: only one traverse?
: without knowing the length?

m********0
发帖数: 2717
5
of course possible for double linked list giving the length.
without length and single linked.
find the length
reverse the second half
traverse from both sub-list
trivial

【在 g*******y 的大作中提到】
: one traversal is impossible. Just iterate to the end will take you 1
: traversal.
: My optimal two and half times of traversal (well, the constant factor for
: low-level instructions will be larger than 2.5 for sure)

g*******y
发帖数: 1930
6
In my opinion, unless explicitly specified, almost all interview problems refer linked list as singly linked list.

【在 m********0 的大作中提到】
: of course possible for double linked list giving the length.
: without length and single linked.
: find the length
: reverse the second half
: traverse from both sub-list
: trivial

m********0
发帖数: 2717
7
xiao wei yang, ni de dao le ta.

refer linked list as singly linked list.

【在 g*******y 的大作中提到】
: In my opinion, unless explicitly specified, almost all interview problems refer linked list as singly linked list.
1 (共1页)
进入JobHunting版参与讨论
相关主题
考算法可以用stl吗?我发现我竟然学会了12种tree traversal的办法
Graph DFS Iterativean interview question, find mode in a rolling window along data sequence
怎么提高BST traversal efficiency?(求推荐)recursion以及把recursion转变为iteration的资料
两道题目FB 上周2电面
大家来看看这个CC150的题LC的BST iterator到底要考察什么?
也报个G家intern面经发个servicenow testing职位的面经和offer
facebook实习面经兼求bless请教leetcode高频题是哪些题
leetcode中的binary tree level order traverse II总是有run t问几个有关Binary tree的题
相关话题的讨论汇总
话题: linked话题: list话题: palindrome话题: judge话题: traversal