- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
算法分析大纲
算法的定义An algorithm is a sequence of unambiguous instructions for solving a computational problem, obtaining a required output for any legitimate input in a finite amount of time.算法是一系列解决问题的清晰指令,也就是说,对于符合一定规范的输入,能够在有限时间内获得所要求的输出。算法的特点Finiteness DefinitenessInputOutputEffectiveness算法的设计步骤Understanding the problem. Read the problem description carefully and ask question if you have any doubts about the problems.Deciding on.deciding on appropriate data structures.Designing an algorithm. An algorithm design technique is a general approach to solving problems algorithmically that is applicable to a variety of problems from different areas of computingProving correctness. The notions of correctness of approximation algorithm is less straightforward than it is for exact algorithm.Analyzing an algorithm. Time efficiency indicates how fast the algorithm runs, space efficiency indicates how much extra memory the algorithm needs.Coding the algorithm. Most algorithm are destined to be ultimately implemented as computer programs. Programming an algorithm presents both a peril and an opportunity.算法效率Time efficiencySpace efficiency增长次数比较1 logn n nlogn n2 n3 2的n次方 n!蛮力法定义A straightforward approach, usually based directly on the problem’s statement and definitions of the concepts involved.蛮力法是一种简单直接地解决问题的方法,通常直接基于问题的描述和所涉及的概念定义。蛮力法优缺点Strengths :1 wide applicability 2 simplicity 3yields reasonable algorithms for some important problems(e.g., matrix multiplication, sorting, searching, string matching) Weaknesses:1 rarely yields efficient algorithms 2some brute-force algorithms are unacceptably slow not as constructive as some other design techniques选择排序和冒泡排序两个算法的比较Selection Sort Bubble Sort 1Stability: Selection Sort is instable ;Bubble Sort is stable2Efficiency:Selection Sort n2;Bubble Sort n23Comparion number: Selection Sort :n(n-1)/2 Bubble Sort: n(n-1)/24input size:n解决背包问题过程和分析W1=7 v1=42 w2=3 v2=12 w3=4 v3=40 w4=5 v4=25 背包W=10子集Subset总重量Total weight总价值 Total value空00{1}7
您可能关注的文档
最近下载
- 体例格式8:工学一体化课程《windows服务器基础配置与局域网组建》任务3学习任务考核方案.docx VIP
- 石方破碎开挖施工组织设计.pdf VIP
- TCCPA-陆上风力发电机组钢混塔架施工与质量验收规范.pdf VIP
- 2025年浙江省江山市中考数学试题及参考答案详解【新】.docx VIP
- 支持性护理对结直肠癌术后结肠造口患者生活质量改善情况分析.pdf VIP
- Goodrive300-01A系列空压机专用变频器说明书.pdf
- 跨境电商平台创业计划书.docx VIP
- 智能制造系统建模与仿真 课件 第1章 智能制造技术的产生及发展.pptx
- 2025年辅警招聘公安基础知识100题及答案.pdf VIP
- 砂浆及砌块原始记录.docx VIP
文档评论(0)