算法分析算法复习题(中英文)(3)
递归方程4分
C A T G C 0 0 0 0 0 0 A 0 0 1 1 1 1 C 0 1 1 1 1 2 T 0 1 1 2 2 2 G 0 1 1 2 3 3 A 0 1 1 2 3 3 T 0 1 1 2 3 4 C 0 1 1 2 3 4 G
最长公共子序列长度为4 AGTC 求解过程6分
十二 From the preceding discussion, it suffices to determine the height of a decision tree in which each permutation appears as a reachable leaf. Consider a decision tree of height h with l reachable leaves corresponding to a comparison sort on n elements.
从前面讨论,它可以确定一个决策树的高度,每个排列显示为一个可到达的叶子。考虑一个决策树的高度h和l可及的叶子在n个元素对应于一种比较。
Because each of the n! permutations of the input appears as some leaf,
因为每个n !排列的输入出现一些叶子,
we have n! ≤ l.
Since a binary tree of height h has no more than 2h leaves, 因为一个二叉树的高度
h没有超过2 h叶子
we have(分析5分) n! ≤ l≤ 2h ,
which, by taking logarithms, implies
h ? lg(n!) (since the lg function is monotonically increasing) = ?(n lg n) 列式和求解5分 十三
Proof: If we decompose path p into v1? vi? vj? vk, then we have that w(p) = w(p1i) + w(pij) +w(pjk). Now, assume that there is a path p’ij from vi to vj with weight w(p’ij)< w(pij) . Then, v1? vi? vj? vk is a path from v1 to vk whose weight w(p1i) + w(p’ij) +w(pjk)is less than w(p), which contradicts the assumption that p is a shortest path from v1 to vk.
反证法假设5分,分析5分
十四
列式5分,求解5分 十五
matrix multiplication:
5分
Floyd-Warshall algorithm:
十六
Heapify(A, i) {
l = Left(i); r = Right(i);
if (l <= heap_size(A) && A[l] > A[i]) largest = l; else largest = i;
if (r <= heap_size(A) && A[r] > A[largest]) largest = r; if (largest != i) Swap(A, i, largest); Heapify(A, largest); }
Fixing up relationships between i, l, and r takes ?(1) time,If the heap at i has n elements, the subtrees at l or r can have 2n/3 elements. So time taken by Heapify() is given by T(n) ? T(2n/3) + ?(1) ,by recursive tree, the solution is T(n) = O(lg n) .算法描述4分 列递归方程3分,求解3分
相关推荐:
- [政务民生]2013年公共基础知识热点问题(七)
- [政务民生]检验检测机构资质认定评审准则及释义20
- [政务民生]关于印发重庆市房屋建筑和市政基础设施
- [政务民生]1、隧道洞身开挖支护施工技术交底书
- [政务民生]2015年山东省17地市中考语文试题分类汇
- [政务民生]2-高级会计师资格考试和评审流程图
- [政务民生]2018版中国清分机行业发展分析及前景策
- [政务民生]新课改高中政治探究
- [政务民生]2018-2024年中国新型组合房屋行业投资
- [政务民生]2015年上海市春季高考数学模拟试卷五
- [政务民生]灌砂法及环刀法测压实度(带计算过程)
- [政务民生]运筹学实验2求解非线性规划
- [政务民生]劝学、逍遥游默写(教师卷)
- [政务民生]《运筹学》 - 期末考试 - 试卷A - 答案
- [政务民生]八年级英语下册 Module 6 Hobbies测试
- [政务民生]2019年宪法知识竞赛试题库100题(含答
- [政务民生]自动化英文文献翻译
- [政务民生]公文格式实施细则
- [政务民生]高一地理上册课堂跟踪练习题6
- [政务民生]会计继续教育习题及答案
- 第三章 无约束最优化方法
- 泛读教程第三册答案
- 魏晋南北朝文学
- 幂的运算复习题
- 城市环境问题的成因与治理策略_以社会
- 钢结构行业产业链及竞争分析研究
- 新型热塑性弹性体增韧聚丙烯的研究
- 中国旅游地理B卷试题及答案
- (苏教版)五年级数学上册第三单元测试卷
- 不稳定性心绞痛诊断与治疗
- 俞氏国际后勤职能部门绩效考核办法
- GB7258-2017新标准考试题含答案
- 小学生汉字听写比赛活动方案
- 1.3《平抛运动》学案 教科版必修2
- 2011香港特别行政区公务员考试复习资料
- 考虑水力条件变化的城市给水管网可靠性
- 表面活性剂在油田开发和生产中的应用
- ITT内部培训资料-FI端吸泵的介绍
- 文明守纪,从我做起学生发言稿
- 初中读《聊斋志异》心得体会800字范文




