avatar
g*s
1
1. word edit distance.
i know it's dp. but what are the legal edit moves?
say, "abcdefg" -> "gabcdef", the distance is 2 or not?
if it's allowed to delete/insert @ any pos, we just delete @ tail and
insert @ head. but the dp recursion definition seems not to cover this
case.
2. longest palindrome substring.
O(N^2) is simple. the optimal is O(N) with suffix tree + lca? anyone can
give a clear description of this solution?
avatar
m*c
2
【 以下文字转载自 Sex 讨论区 】
发信人: laday (laday), 信区: Sex
标 题: 征GG
关键字: AZNK
发信站: BBS 未名空间站 (Thu Jan 20 20:22:12 2011, 美东)
小女子23,聪慧秀丽。奈何近来拮据,想找个大叔或者大哥包养我一段。
我在美西部。
avatar
r*e
3
1. "abcdefg" -> "abcdef" -> "gabcdef", the distance is 2
deletion and the addtion are counted as 2 edits, not a single one
2. one can build a (basic) suffix tree for the string txt1$txt2#, where `$'
is a special terminator for txt1 and `#' is a special terminator for txt2.
The longest common substring is indicated by the deepest fork node that has
both `$...' and `...#' (no $) beneath it.
The longest palindrome of txt[1..n] can be found in O(n) time, by building
the suffix tree for txt$reverse(txt)#
see http://www.allisons.org/ll/AlgDS/Tree/Suffix/

【在 g*********s 的大作中提到】
: 1. word edit distance.
: i know it's dp. but what are the legal edit moves?
: say, "abcdefg" -> "gabcdef", the distance is 2 or not?
: if it's allowed to delete/insert @ any pos, we just delete @ tail and
: insert @ head. but the dp recursion definition seems not to cover this
: case.
: 2. longest palindrome substring.
: O(N^2) is simple. the optimal is O(N) with suffix tree + lca? anyone can
: give a clear description of this solution?

avatar
c*o
4
价钱几何?

【在 m***c 的大作中提到】
: 【 以下文字转载自 Sex 讨论区 】
: 发信人: laday (laday), 信区: Sex
: 标 题: 征GG
: 关键字: AZNK
: 发信站: BBS 未名空间站 (Thu Jan 20 20:22:12 2011, 美东)
: 小女子23,聪慧秀丽。奈何近来拮据,想找个大叔或者大哥包养我一段。
: 我在美西部。

avatar
g*s
5

then how to build the dp table?
`$'
txt2.
has
building

【在 r*******e 的大作中提到】
: 1. "abcdefg" -> "abcdef" -> "gabcdef", the distance is 2
: deletion and the addtion are counted as 2 edits, not a single one
: 2. one can build a (basic) suffix tree for the string txt1$txt2#, where `$'
: is a special terminator for txt1 and `#' is a special terminator for txt2.
: The longest common substring is indicated by the deepest fork node that has
: both `$...' and `...#' (no $) beneath it.
: The longest palindrome of txt[1..n] can be found in O(n) time, by building
: the suffix tree for txt$reverse(txt)#
: see http://www.allisons.org/ll/AlgDS/Tree/Suffix/

avatar
x*s
6
老大你要包养啊?
avatar
b*r
7

`$'
txt2.
has
building
for the case:
abcdxyzdcba
What's the longest palindrome?, the longest common string for txt and
reverse(txt) is abcd, but it's not palindrome

【在 r*******e 的大作中提到】
: 1. "abcdefg" -> "abcdef" -> "gabcdef", the distance is 2
: deletion and the addtion are counted as 2 edits, not a single one
: 2. one can build a (basic) suffix tree for the string txt1$txt2#, where `$'
: is a special terminator for txt1 and `#' is a special terminator for txt2.
: The longest common substring is indicated by the deepest fork node that has
: both `$...' and `...#' (no $) beneath it.
: The longest palindrome of txt[1..n] can be found in O(n) time, by building
: the suffix tree for txt$reverse(txt)#
: see http://www.allisons.org/ll/AlgDS/Tree/Suffix/

avatar
c*o
8
了解一下市场。

老大你要包养啊?

【在 x**********s 的大作中提到】
: 老大你要包养啊?
avatar
g*e
9
第一题上班没空仔细看,第二题,看这个link,俺搞了一个星期才写出完整的代码
http://blog.csdn.net/g9yuayon/archive/2008/06/21/2574781.aspx

【在 g*********s 的大作中提到】
: 1. word edit distance.
: i know it's dp. but what are the legal edit moves?
: say, "abcdefg" -> "gabcdef", the distance is 2 or not?
: if it's allowed to delete/insert @ any pos, we just delete @ tail and
: insert @ head. but the dp recursion definition seems not to cover this
: case.
: 2. longest palindrome substring.
: O(N^2) is simple. the optimal is O(N) with suffix tree + lca? anyone can
: give a clear description of this solution?

avatar
x*s
10
老大,我在你地盘上post了一条,你帮我照着点

【在 c*******o 的大作中提到】
: 了解一下市场。
:
: 老大你要包养啊?

avatar
h*1
12
第二题能写出N^2 的算法就可以了吧。至于那个N的算法,我觉得知道就可以了。要真
考那个Ukkonen的suffix tree 算法,那真是太疯狂了。
avatar
r*e
13
the longest common string of txt and reverse(txt) is not necessarily the
longest palindrome (I didn't say that in my last post)
we still need to check the positions
the length of the common string plus the lengths of the portions before $/#
in the two child nodes should be equal to strlen(txt).

【在 b**********r 的大作中提到】
:
: `$'
: txt2.
: has
: building
: for the case:
: abcdxyzdcba
: What's the longest palindrome?, the longest common string for txt and
: reverse(txt) is abcd, but it's not palindrome

avatar
s*y
14
同问,suffix tree和trie的要当场写吗?
avatar
g*e
15
面试的人没几个知道suffix tree和trie的
某投行的一个哥们还问我两遍我trie是不是拼错了,应该是tree

【在 s*****y 的大作中提到】
: 同问,suffix tree和trie的要当场写吗?
avatar
g*s
16
i think i missed this one:
if s[i] = t[j] then
d[i, j] := d[i-1, j-1] // no operation required

【在 r*******e 的大作中提到】
: http://en.wikipedia.org/wiki/Levenshtein_distance
: the pseudo code listed on the page works for ur case

avatar
s*y
17
那就好,还以为自己太弱了,同事说他phd的时候就把trie用硬件语言写进FPGA里面做
routing table look up。

【在 g**e 的大作中提到】
: 面试的人没几个知道suffix tree和trie的
: 某投行的一个哥们还问我两遍我trie是不是拼错了,应该是tree

avatar
g*e
18
某大牛告诉我,很多时候坐你对面面试你的人都不如你。 take it easy
这样想我面试的时候就轻松多了,呵呵

【在 s*****y 的大作中提到】
: 那就好,还以为自己太弱了,同事说他phd的时候就把trie用硬件语言写进FPGA里面做
: routing table look up。

avatar
g*s
19
i don't care if the interviewer is better than me or not. but i do care if
they correctly understand and respond my points.

【在 g**e 的大作中提到】
: 某大牛告诉我,很多时候坐你对面面试你的人都不如你。 take it easy
: 这样想我面试的时候就轻松多了,呵呵

avatar
g*e
20
care or not, there is nothing you can do about it. My point is that we don't
have to bash ourselves if we don't know all the algorithms or data
structures or can't solve all the problems in this forum. Confidence helps a
lot in an interview.

【在 g*********s 的大作中提到】
: i don't care if the interviewer is better than me or not. but i do care if
: they correctly understand and respond my points.

avatar
g*s
21
1. word edit distance.
i know it's dp. but what are the legal edit moves?
say, "abcdefg" -> "gabcdef", the distance is 2 or not?
if it's allowed to delete/insert @ any pos, we just delete @ tail and
insert @ head. but the dp recursion definition seems not to cover this
case.
2. longest palindrome substring.
O(N^2) is simple. the optimal is O(N) with suffix tree + lca? anyone can
give a clear description of this solution?
avatar
r*e
22
1. "abcdefg" -> "abcdef" -> "gabcdef", the distance is 2
deletion and the addtion are counted as 2 edits, not a single one
2. one can build a (basic) suffix tree for the string txt1$txt2#, where `$'
is a special terminator for txt1 and `#' is a special terminator for txt2.
The longest common substring is indicated by the deepest fork node that has
both `$...' and `...#' (no $) beneath it.
The longest palindrome of txt[1..n] can be found in O(n) time, by building
the suffix tree for txt$reverse(txt)#
see http://www.allisons.org/ll/AlgDS/Tree/Suffix/

【在 g*********s 的大作中提到】
: 1. word edit distance.
: i know it's dp. but what are the legal edit moves?
: say, "abcdefg" -> "gabcdef", the distance is 2 or not?
: if it's allowed to delete/insert @ any pos, we just delete @ tail and
: insert @ head. but the dp recursion definition seems not to cover this
: case.
: 2. longest palindrome substring.
: O(N^2) is simple. the optimal is O(N) with suffix tree + lca? anyone can
: give a clear description of this solution?

avatar
g*s
23

then how to build the dp table?
`$'
txt2.
has
building

【在 r*******e 的大作中提到】
: 1. "abcdefg" -> "abcdef" -> "gabcdef", the distance is 2
: deletion and the addtion are counted as 2 edits, not a single one
: 2. one can build a (basic) suffix tree for the string txt1$txt2#, where `$'
: is a special terminator for txt1 and `#' is a special terminator for txt2.
: The longest common substring is indicated by the deepest fork node that has
: both `$...' and `...#' (no $) beneath it.
: The longest palindrome of txt[1..n] can be found in O(n) time, by building
: the suffix tree for txt$reverse(txt)#
: see http://www.allisons.org/ll/AlgDS/Tree/Suffix/

avatar
b*r
24

`$'
txt2.
has
building
for the case:
abcdxyzdcba
What's the longest palindrome?, the longest common string for txt and
reverse(txt) is abcd, but it's not palindrome

【在 r*******e 的大作中提到】
: 1. "abcdefg" -> "abcdef" -> "gabcdef", the distance is 2
: deletion and the addtion are counted as 2 edits, not a single one
: 2. one can build a (basic) suffix tree for the string txt1$txt2#, where `$'
: is a special terminator for txt1 and `#' is a special terminator for txt2.
: The longest common substring is indicated by the deepest fork node that has
: both `$...' and `...#' (no $) beneath it.
: The longest palindrome of txt[1..n] can be found in O(n) time, by building
: the suffix tree for txt$reverse(txt)#
: see http://www.allisons.org/ll/AlgDS/Tree/Suffix/

avatar
g*e
25
第一题上班没空仔细看,第二题,看这个link,俺搞了一个星期才写出完整的代码
http://blog.csdn.net/g9yuayon/archive/2008/06/21/2574781.aspx

【在 g*********s 的大作中提到】
: 1. word edit distance.
: i know it's dp. but what are the legal edit moves?
: say, "abcdefg" -> "gabcdef", the distance is 2 or not?
: if it's allowed to delete/insert @ any pos, we just delete @ tail and
: insert @ head. but the dp recursion definition seems not to cover this
: case.
: 2. longest palindrome substring.
: O(N^2) is simple. the optimal is O(N) with suffix tree + lca? anyone can
: give a clear description of this solution?

avatar
h*1
27
第二题能写出N^2 的算法就可以了吧。至于那个N的算法,我觉得知道就可以了。要真
考那个Ukkonen的suffix tree 算法,那真是太疯狂了。
avatar
r*e
28
the longest common string of txt and reverse(txt) is not necessarily the
longest palindrome (I didn't say that in my last post)
we still need to check the positions
the length of the common string plus the lengths of the portions before $/#
in the two child nodes should be equal to strlen(txt).

【在 b**********r 的大作中提到】
:
: `$'
: txt2.
: has
: building
: for the case:
: abcdxyzdcba
: What's the longest palindrome?, the longest common string for txt and
: reverse(txt) is abcd, but it's not palindrome

avatar
s*y
29
同问,suffix tree和trie的要当场写吗?
avatar
g*e
30
面试的人没几个知道suffix tree和trie的
某投行的一个哥们还问我两遍我trie是不是拼错了,应该是tree

【在 s*****y 的大作中提到】
: 同问,suffix tree和trie的要当场写吗?
avatar
g*s
31
i think i missed this one:
if s[i] = t[j] then
d[i, j] := d[i-1, j-1] // no operation required

【在 r*******e 的大作中提到】
: http://en.wikipedia.org/wiki/Levenshtein_distance
: the pseudo code listed on the page works for ur case

avatar
s*y
32
那就好,还以为自己太弱了,同事说他phd的时候就把trie用硬件语言写进FPGA里面做
routing table look up。

【在 g**e 的大作中提到】
: 面试的人没几个知道suffix tree和trie的
: 某投行的一个哥们还问我两遍我trie是不是拼错了,应该是tree

avatar
g*e
33
某大牛告诉我,很多时候坐你对面面试你的人都不如你。 take it easy
这样想我面试的时候就轻松多了,呵呵

【在 s*****y 的大作中提到】
: 那就好,还以为自己太弱了,同事说他phd的时候就把trie用硬件语言写进FPGA里面做
: routing table look up。

avatar
g*s
34
i don't care if the interviewer is better than me or not. but i do care if
they correctly understand and respond my points.

【在 g**e 的大作中提到】
: 某大牛告诉我,很多时候坐你对面面试你的人都不如你。 take it easy
: 这样想我面试的时候就轻松多了,呵呵

avatar
g*e
35
care or not, there is nothing you can do about it. My point is that we don't
have to bash ourselves if we don't know all the algorithms or data
structures or can't solve all the problems in this forum. Confidence helps a
lot in an interview.

【在 g*********s 的大作中提到】
: i don't care if the interviewer is better than me or not. but i do care if
: they correctly understand and respond my points.

avatar
b*g
36
working on more problems is the way to be confidence.

't
a

【在 g**e 的大作中提到】
: care or not, there is nothing you can do about it. My point is that we don't
: have to bash ourselves if we don't know all the algorithms or data
: structures or can't solve all the problems in this forum. Confidence helps a
: lot in an interview.

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