Redian新闻
>
降级I-140 nsc 接收一个月后准备追加pp, part4.8 还选no?
avatar
降级I-140 nsc 接收一个月后准备追加pp, part4.8 还选no?# EB23 - 劳工卡
b*g
1
我现在想到的就是
1. 先遍历t1 and t2, 找到他们的size,
2. 假设t2比较小,然后就是看t1有无t2
3. 那么我的算法就是
match(Tree t1, Tree t2){
if(t1.value=t2.value)
return match(t1.left,t2.left) && match(t1.right,t2.right);
else
return match(t1.left,t2) || match(t1.right,t2);
}
complexity |t2|*|t1|
有无更好的算法?
avatar
c*6
2
降级I-140 nsc 接收一个月后追加pp, part4.8 还选no?
信不过律师了 帮他把把关!
======
“part4里。。。 8一定要填no”
8.If the petition is being filed without an original labor
certification, are you requesting that USCIS request a
duplicate labor certification from the Department of Labor?
Yes - Attach an explanation
No
★ 发自iPhone App: ChineseWeb 8.6
avatar
p*2
3

code感觉不是很对呀。不过复杂度也应该就是这个了。没什么好办法。不过这个复杂度
是worst case。

【在 b******g 的大作中提到】
: 我现在想到的就是
: 1. 先遍历t1 and t2, 找到他们的size,
: 2. 假设t2比较小,然后就是看t1有无t2
: 3. 那么我的算法就是
: match(Tree t1, Tree t2){
: if(t1.value=t2.value)
: return match(t1.left,t2.left) && match(t1.right,t2.right);
: else
: return match(t1.left,t2) || match(t1.right,t2);
: }

avatar
l*n
4
这个是140的,不是140PP的吧
avatar
r*n
5
相同是指子树的结点个数相同?

【在 b******g 的大作中提到】
: 我现在想到的就是
: 1. 先遍历t1 and t2, 找到他们的size,
: 2. 假设t2比较小,然后就是看t1有无t2
: 3. 那么我的算法就是
: match(Tree t1, Tree t2){
: if(t1.value=t2.value)
: return match(t1.left,t2.left) && match(t1.right,t2.right);
: else
: return match(t1.left,t2) || match(t1.right,t2);
: }

avatar
F*u
6
人家说的是准备pp

【在 l*******n 的大作中提到】
: 这个是140的,不是140PP的吧
avatar
w*z
7
What is your base step?
You need to remember the match t1 node (Let's mark it MatchRoot) the as t2'
root.
If you find the unmatch, you need to back from the previous matching root (
MatchRoot) and going down again from its children.
avatar
c*6
8
这一项是I-140 pp 的表格, 也就是 i-907 里的。

★ 发自iPhone App: ChineseWeb 8.6

【在 l*******n 的大作中提到】
: 这个是140的,不是140PP的吧
avatar
b*g
9
相同是说不光结构相同,而且每个对应的value也相同。根据peking2 和 wwzz建议,我
给个全的,也是个大概,可能边角没有考虑。
int matchRoot(Tree t1, Tree t2)
{
Queue q1=new Queue();
q1.enqueue(t2);
int size=0;
while(q1.size()){
Tree tmp=q1.dequeue();
if(!match(t1,tmpTree)){
if(!tmp.left)
q1.enqueue(tmp.left);
if(!tmp.right)
q1.enqueue(tmp.right);
}else{
size=tmp.size();
}

}
return size;
}
match(Tree t1, Tree t2){
if(t1.value=t2.value)
return match(t1.left,t2.left) && match(t1.right,t2.right);
else
return match(t1.left,t2) || match(t1.right,t2);
}
avatar
F*u
10
你再看看

【在 c*******6 的大作中提到】
: 这一项是I-140 pp 的表格, 也就是 i-907 里的。
:
: ★ 发自iPhone App: ChineseWeb 8.6

avatar
w*z
11
You don't have your base step for your recursive match method. Your method
runs in to NPE eventually
Need to check t1.left/right, t2.left/righ == null. All of null, return true.
If children structure mismatch, (t1 has left, t2 doesn't, etc) return false.
If children structure match, recursively calling match with non-null
children
avatar
c*6
12
忙糊涂了 谢谢

【在 F*********u 的大作中提到】
: 你再看看
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。