- 1
- 0
- 约4.39千字
- 约 18页
- 2016-09-21 发布于江西
- 举报
第六讲 代码优化30036.ppt
第六讲 专题解析——代码优化 The Problem and a Simple Program The problem arose in one-dimensional pattern recognition 输入是n维实数数组x; 输出连续子数组的和为最大的(最大字段和). 例如,输入数组如下: 则返回子数组 X[3 .. 7], 和为 187. Simple Program The obvious program for this task is simple: for each pair of integers L and U (where 1 L U N), compute the sum of X[L.. U] and check whether that sum is greater than the maximum sum so far. The pseudocode given in Algorithm, it executes is O(N3). MaxSoFar = 0 for i = [0, n) for j = [i, n) sum = 0 for k = [i, j] sum += x[k] /* Sum now contains the sum of X[i..j] */
您可能关注的文档
最近下载
- 《鲁滨逊漂流记》名著导读好书推荐(共27张PPT).pptx VIP
- 建筑工地实习日记40篇.doc VIP
- 男患者导尿术操作评分标准.docx VIP
- 港口道路与堆场施工规范(JTS_T 216-2021).docx VIP
- 高职数学定积分及其应用教学能力比赛教案.pdf
- 高中数学计数原理.pdf VIP
- DB45_T 2562-2022 公路预应力混凝土梁预制技术规范.docx VIP
- 扶梯拆除施工方案.docx VIP
- GB 50058-2014 爆炸危险环境电力装置设计规范.docx VIP
- DB45_T2562-2022_公路预应力混凝土梁预制技术规范_广西壮族自治区 conv.docx VIP
原创力文档

文档评论(0)