Redian新闻
>
[合集] 再问同学们:70%左右的eb1a chance,可不可以冒险做?
avatar
[合集] 再问同学们:70%左右的eb1a chance,可不可以冒险做?# Immigration - 落地生根
c*2
1
Remove a node from a singly linkedlist without knowing the head node. All
you have is the node itself.
avatar
H*y
2
☆─────────────────────────────────────☆
kuawo (kuawa) 于 (Fri May 21 17:44:18 2010, 美东) 提到:
问了几个律师,除了谢之外,其余似乎都觉得可以做,只是NIW大约90%左右的可能,
eb1a弱点,70%左右吧。(不知道可信否)
我是不是可以冒险试一次?
如果谁知道稍微好点的律师,请推荐一下,谢谢。
背景CS/EE 方向。
3篇非第一作者的中文journal(大学学报),老板第一作者。
7篇top conference papers (double blind peer review)
7篇second tier conference papers (single blind peer review)
6篇workshop级别的paper
有一个worshop是比赛型的,国际性的,有一年的结果rank top 5。没有奖,只在当年
的workshop review中,组织者有个图表说明。
citation:
有两篇08年的总共大概75吧,09年有篇18。
总体有110个独立citation吧。很少
avatar
h*o
3
please understand what is "a" node
this is tricky

【在 c***2 的大作中提到】
: Remove a node from a singly linkedlist without knowing the head node. All
: you have is the node itself.

avatar
d*e
4
re这个,我觉得不行

【在 h***o 的大作中提到】
: please understand what is "a" node
: this is tricky

avatar
c*2
5
1) Try to run it, got infinite loop with random addresses
2) This is a wrong question
avatar
c*2
6
This is not in an interview, if you know the trick, spit it out.

【在 h***o 的大作中提到】
: please understand what is "a" node
: this is tricky

avatar
d*e
7
because that node is not really deleted.
you made a trick to simply modify the value inside that node and delete its
next node. from the outside, if you retrieve the value information, it looks
like the node was deleted. But actually, it is not.
if we have such case:
avatar
c*2
8
Yes, that's definitely right.
But over here, we don't have access to p;
How to set it to NULL?
Suppose
p->next=q
free(q);
q=NULL;
this won't set p->next to NULL.
I am really confused.
I only use C, can any other lanuague support this feature?

its
looks

【在 d**e 的大作中提到】
: because that node is not really deleted.
: you made a trick to simply modify the value inside that node and delete its
: next node. from the outside, if you retrieve the value information, it looks
: like the node was deleted. But actually, it is not.
: if we have such case:

avatar
c*n
9
remember the previous one,
set the previous->next = cur-> next,
delete cur

【在 c***2 的大作中提到】
: Remove a node from a singly linkedlist without knowing the head node. All
: you have is the node itself.

avatar
l*a
10
if it is the last node of the linked list
you can only start from the beginning.
u need to know the head.otherwise u can't solve this problem.
for time complexity,
(n-1 * 1 +1 *n-1)/n=O(1)

【在 c***2 的大作中提到】
: Yes, that's definitely right.
: But over here, we don't have access to p;
: How to set it to NULL?
: Suppose
: p->next=q
: free(q);
: q=NULL;
: this won't set p->next to NULL.
: I am really confused.
: I only use C, can any other lanuague support this feature?

avatar
l*v
11
sentinel

【在 c***2 的大作中提到】
: Remove a node from a singly linkedlist without knowing the head node. All
: you have is the node itself.

avatar
c*2
12
The question shall be modified as "delete a *middle* node".
avatar
l*a
13
Don't u think that is a hint?

【在 c***2 的大作中提到】
: The question shall be modified as "delete a *middle* node".
avatar
c*2
14
otherwise, there is no solution for the last node. AN dturns this question
invalid.
avatar
l*v
15
sentinel node

【在 c***2 的大作中提到】
: otherwise, there is no solution for the last node. AN dturns this question
: invalid.

avatar
c*2
16
A dummy tail node.
that works.
free(node);
node=tail;
when traverse: while(p) ==> while(p!=tail).
But this does not comply with the question: "All
you have is the node itself." :-)
avatar
l*v
17
with senitel tail node, you don't have special case for last node. Here is
modification of your original code
boolean removeNode(Node * p){
Node * temp;
if (NULL == p){
return FALSE;
}
temp = p.next;
p.value = temp.value;
p.next = temp.next;
free(temp);
return TRUE;
}
avatar
c*2
18
Finally got it: with a fixed dummy tail node, there is NO last node.
Thanks,
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。