由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - A problem.
相关主题
问一道数据结构题求问一道面试题
求教一个combination的问题,求好方法Microsoft 一道算法题
发Google面经,为明天MS攒rpThe time complexity on finding the kth largest element in a
share一个a公司的2nd phone算法作业2
问CareerCup(第四版)一题的高效做法,谢谢!ways of increasing subsequence (转载)
打印从根到叶子节点所有路径的问题问个算法题之被dynamic programming打败了
借人气问一道Samsung的题shortest path problem
这个题做的对吗?问个g的面试题
相关话题的讨论汇总
话题: problem话题: spath话题: complexity话题: path话题: shortest
进入JobHunting版参与讨论
1 (共1页)
b*******e
发帖数: 217
1
A graph, find the shortest path between S and T with the number of edges = K
.
What is the complexity of your algorithm.
l***i
发帖数: 1309
2
这个好阴险阿,如果K = |V|,
this is hamitonian path problem and is hence NP-hard, what is your algorithm
's complexity
Here I assume by path you mean a sequence of edges with no repeated vertex.
b*******e
发帖数: 217
3
this is a DP problem.
SPath(S, V, K) = Min(SPath(S, Parents of V, K-1) + W)
this is called shortest reliable path problem.
Y**Y
发帖数: 66
4
D(S, 0) = 0
D(v, 0) = infinity when v != S
loop i=1...K
D(v, i) = min {D(u, i-1)+w(u,v)}, for all edge (u, v) in E.
return D(T, K).
complexity K*(|V|+|E|)

K

【在 b*******e 的大作中提到】
: A graph, find the shortest path between S and T with the number of edges = K
: .
: What is the complexity of your algorithm.

b*******e
发帖数: 217
5
anyway, shortest path is a DP.
Spath(s, V) = Min(SPath(s, Parent of v) + W));
here introduce one more dimension: number k of edges.

【在 b*******e 的大作中提到】
: this is a DP problem.
: SPath(S, V, K) = Min(SPath(S, Parents of V, K-1) + W)
: this is called shortest reliable path problem.

f*****e
发帖数: 2992
6
点边都可以重复,牛啊。

【在 b*******e 的大作中提到】
: this is a DP problem.
: SPath(S, V, K) = Min(SPath(S, Parents of V, K-1) + W)
: this is called shortest reliable path problem.

b*******e
发帖数: 217
7
why? ANY THING WRONG WITH THE RECURSIVE FUNJCTION? i MAY MISS SOMETHIGN...
THOUGH.
"PARENT" INDICAES NOT GO BACK.
1 (共1页)
进入JobHunting版参与讨论
相关主题
问个g的面试题问CareerCup(第四版)一题的高效做法,谢谢!
How to compute power(x,y) in O(1) space打印从根到叶子节点所有路径的问题
array a1,a2,... ,an, b1,b2,..., bn借人气问一道Samsung的题
两个二叉树,找出最大的相同子树这个题做的对吗?
问一道数据结构题求问一道面试题
求教一个combination的问题,求好方法Microsoft 一道算法题
发Google面经,为明天MS攒rpThe time complexity on finding the kth largest element in a
share一个a公司的2nd phone算法作业2
相关话题的讨论汇总
话题: problem话题: spath话题: complexity话题: path话题: shortest