数据结构算法
文章平均质量分 79
dengjiaxing0321
这个作者很懒,什么都没留下…
展开
-
算法代码
题目:Say you have an array for which the i-th element is the price of a given stock on day i.Design an algorithm and implement it to nd the maximum pro t. You may complete at most two transactions.N原创 2015-10-23 00:24:25 · 386 阅读 · 0 评论 -
动态规划问题
题目索引 1.三角形找一条从顶到底的最小路径 分析 设状态为 f (i; j ),表示从从位置 (i; j ) 出发,路径的最小和,则状态转移方程为 f(i,j)=min{f(i+1,j),f(i+1,j+1)}+(i,j) 2.最大子数组和 设状态为 f[j],表示以 S[j] 结尾的最大连续子序列和,状态转移方程如下: f=max(f+A[i],A[i]);//对于转载 2015-10-23 00:35:54 · 239 阅读 · 0 评论