有哪些算法设计与方法? - 数据结构 - 机器学习
#daohang ul li t,.reed .riqi,a.shangg,a.xiatt,a.shangg:hover,a.xiatt:hover,a.shang,a.xiat,a.shang:hover,a.xiat:hover,.reed-pinglun-anniu,span.now-page,#daohangs-around,#caidan-tubiao,#daohangs,#daohangs li,#btnPost{background-color:#D10B04;}
.dinglanyou1 h3{border-bottom:3px solid #D10B04;}
#dibuer{border-top:2px solid #D10B04;}.cebianlan .rongqi h3{border-bottom:1px solid #D10B04;}
#edtSearch{border:1px solid #D10B04;}
#daohang .zuo ul li{border-right:1px solid #;}
#daohang ul li t a{border-top:1px solid #;border-right:1px solid #D10B04;}
#daohang ul li t a:hover{border-right:1px solid #;}
#daohang .you ul li a:hover,#daohang .zuo ul li a:hover,.reed-pinglun-anniu:hover{background-color:#;}
a:hover,.reed h6 a:hover,#dibuer a:hover,.reed .riqiding,.cebianlan .rongqi li a:hover,#pinglun-liebiao ul.fubens li.depth-1 dl dd span.shu a,#pinglun-liebiao ul.fubens li.depth-1 dl dd span.huifuliuyan a:hover,.reed-biaoti h6 span{color:#D10B04;}
.reed .kan a{color:#0A0AF5;}.reed .kan a:hover{color:#D10101;}
@media screen and (max-width:1492px){a.shang,a.xiat{background:none;}
a.xiat:hover,a.shang:hover{background-color:#f9f9f9;background-image:none;text-decoration:none;}}
var _hmt = _hmt || [];(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?b19db5ba3b437a9e8698d2bc8fc64334"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})();
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b19db5ba3b437a9e8698d2bc8fc64334";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?2d748c9763cfc72fb7d1ccab29f0770d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?f6d451f3f1be23f3abf240c64c469c1b";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();

(function() {
var s = "_" + Math.random().toString(36).slice(2);
document.write('
');
(window.slotbydup = window.slotbydup || []).push({
id: "u3646201",
container: s
});
})();
(function() {
var s = "_" + Math.random().toString(36).slice(2);
document.write('
');
(window.slotbydup = window.slotbydup || []).push({
id: "u3646162",
container: s
});
})();
有哪些算法设计与方法?
1308 人参与 2018年08月18日 08:59 分类 : 数据结构精品文章 评论
要制定一个算法,一般要经过设计、确认、分析、编码、检查、调试、计时等阶段,因此学习计算机算法必须涉及这些方面的内容。在这些内容中有许多都是现今重要而活跃的研究领域。为便于区别,把算法学习的内容分成五个不同的方面:
(一)何设计算法
设计算法的工作是不可能完全自动化的。本书是要使读者学会已被实践证明是有用的一些基本设计策略。这些策略不仅在计算机科学,而且在运筹学、电气工程等多个领域都是非常有用的,利用它们已经设计出了很多精致有效的好算法。读者们一旦掌握了这些策略,也一定会设计出更多新的、有用的算法。
(二)如何表示算法
语言是交流思想的工具,设计的算法也要用语言恰当地表示出来。本书基本采用结构程序设计的方式,选择了一种名为SPARKS的程序设计语言来简单明了地表示算法。至于结构程序设计的内容本书并不打算具体介绍,而是将所能收集到的那些主要结构用于本书所给出的算法之中,只是在本章的最后一节详细讨论了一种非常重要的结构——递归。
(三)如何确认算法
一旦设计出了算法,就应证明它对所有可能的合法输入都能算出正确的答案,这一工作称为算法确认(algorithm validation)。要指出的是,用SPARKS所描述的算法还不足以是一个可以立即投入机器运行的程序。确认的目的在于使我们确信这一算法将能正确无误地工作,而与写出这一算法所用的程序语言无关。一旦证明了算法的正确性,就可将其写成程序,在将程序放到机器上运行之前,实际上还应证明程序是正确的,即证明程序对所有可能的合法输入都能得到正确的结果,这一工作称为程序证明(program proving)。这一领域是当前很多计算机科学工作者集中研究的对象,还处于相当初期的阶段。在这一领域的工作还没取得突破性的进展之前,为了增强对所编制程序的置信度,只能用对程序的测试来权宜代替。
(四)如何分析算法
在前面对有穷性的讨论中,曾提及只应把能在相当有穷步内终止的算法实际投入计算机运行。细心的读者可能当时就会觉得“相当”一词用得非常含糊,能否对有穷步给出一个数量界限呢?这实际上是我们要在这里回答的问题。执行一个算法,要使用计算机的中央处理器(CPU)完成各种运算,要用存储器来存放程序和数据。算法分析(analysis of algorithms)是对一个算法需要多少计算时间和存储空间作定量的分析。分析算法不仅可以预计所设计的算法能在什么样的环境中有效地运行,而且可以知道在最好、最坏和平均情况下执行得怎么样,还可以使读者对解决同一问题不同算法的有效性作出比较判断。关于算法分析更确切的表征将在下一节讨论。
(五)如何测试程序
测试程序实际上由调试和作时空分布图两部分组成。调试(debugging)程序是在抽象数据集上执行程序,以确定是否会产生错误的结果,若有,则修改程序。但是,这一工作正如著名计算机科学家迪伊克斯特拉(E.Dijkstra)所说的那样,“调试只能指出有错误,而不能指出它们不存在错误。”尽管如此,在程序正确性证明还没取得突破性进展的今天,调试仍是不可缺少且必须认真进行的一项重要工作。作时空分布图是用各种给定的数据执行调试认为是正确的程序,并测定为计算出结果所花去的时间和空间,以印证以前所作的分析是否正确和指出实现最优化的有效逻辑位置。
来源:我是码农,转载请保留出处和链接!
本文链接:http://www.54manong.com/?id=8
(function() {
var s = "_" + Math.random().toString(36).slice(2);
document.write('
');
(window.slotbydup = window.slotbydup || []).push({
id: "u3646208",
container: s
});
})();
(function() {
var s = "_" + Math.random().toString(36).slice(2);
document.write('
');
(window.slotbydup = window.slotbydup || []).push({
id: "u3646147",
container: s
});
})();
window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdPic":"","bdStyle":"0","bdSize":"16"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
数据结构 微信号:qq444848023 QQ号:444848023
加入【我是码农】QQ群:864689844(加群验证:我是码农)
<< 上一篇
下一篇 >>
(function() {
var s = "_" + Math.random().toString(36).slice(2);
document.write('
');
(window.slotbydup = window.slotbydup || []).push({
id: "u3646186",
container: s
});
})();
(function() {
var s = "_" + Math.random().toString(36).slice(2);
document.write('
');
(window.slotbydup = window.slotbydup || []).push({
id: "u3646175",
container: s
});
})();
搜索
网站分类
标签列表
最近发表
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https'){
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else{
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
全站首页 |
数据结构 |
区块链|
大数据 |
机器学习 |
物联网和云计算 |
面试笔试
var cnzz_protocol = (("https:" == document.location.protocol) ? "https://" : "http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1276413723'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s23.cnzz.com/z_stat.php%3Fid%3D1276413723%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));本站资源大部分来自互联网,版权归原作者所有!
jQuery(document).ready(function($){
/* prepend menu icon */
$('#daohangs-around').prepend('
');
/* toggle nav */
$("#caidan-tubiao").on("click", function(){
$("#daohangs").slideToggle();
$(this).toggleClass("active");
});
});
评论专区