由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - ways of increasing subsequence (转载)
相关主题
求教一个combination的问题,求好方法请教一个DP的问题
问个题,bt中找最大的bstone amazon interview problem
Maximum Sum of Increasing Sequencenlogn for longest increasing subsequence
问一道数据结构题longest increasing subsequence O(NlogN)算法中数组 P 是否必
面试题count # of increasing subsequences of String求解Longest Increasing Subsequence O(NLOG(N)) 解法
DP的状态转移方程g公司面试问Longest increasing subsequence,意义在哪里?
问一道算法题max length of subsequence string matching subs看到一个longest increasing subsequence挺有意思的算法
一个算法题:Selecting median of three sorted arraysLongest Increasing Subsequence用binary还能输出结果数组吗?
相关话题的讨论汇总
话题: ways话题: seq话题: global话题: int话题: infinity
进入JobHunting版参与讨论
1 (共1页)
c******n
发帖数: 4965
1
【 以下文字转载自 SiliconValleyClub 俱乐部 】
发信人: creation (努力自由泳50m/45sec !), 信区: SiliconValleyClub
标 题: ways of increasing subsequence
发信站: BBS 未名空间站 (Thu Feb 17 03:33:25 2011, 美东)
http://www.careercup.com/question?id=7725662
I thought the recursive version is rather simple, right?
int global_seq = { 1, 4,2,4,6,8,2,5 }
int ways(int sub_seq_len ) {
return ways(global_seq.length, sub_seq_len, +infinity);
}
int ways( int n, int k, int max ) {
if ( global_seq[decide_point] <= max )
return ways(n-1, k, max ) + ways (n-1, k-1, global_seq[n]);
else
return ways(n-1, k, max);
}
DP version would be
infinity = max(global_seq);
ways[0][1----K][0---infinity] = 0;
ways[0 --- global_seq.length][0][0---infinity] = 1;
for (k = 1 to K )
for (n = 1 to global_seq.length )
for( max = 1 to infinity )
if (.......)
..... same logic as above
g***s
发帖数: 3811
2
calculate the time complexity for your codes.【 在 creation (努力自由泳
50m/45sec !) 的大作中提到: 】
1 (共1页)
进入JobHunting版参与讨论
相关主题
Longest Increasing Subsequence用binary还能输出结果数组吗?面试题count # of increasing subsequences of String求解
求Longest_Increasing_Subsequence JAVA O(nlgn) 代码DP的状态转移方程
Distinct Subsequence问一道算法题max length of subsequence string matching subs
帮忙看个题一个算法题:Selecting median of three sorted arrays
求教一个combination的问题,求好方法请教一个DP的问题
问个题,bt中找最大的bstone amazon interview problem
Maximum Sum of Increasing Sequencenlogn for longest increasing subsequence
问一道数据结构题longest increasing subsequence O(NlogN)算法中数组 P 是否必
相关话题的讨论汇总
话题: ways话题: seq话题: global话题: int话题: infinity