Skip to Content
算法技术手册(原书第2 版)
book

算法技术手册(原书第2 版)

by George T.Heineman, Gary Pollice, Stanley Selkow
August 2017
Intermediate to advanced
360 pages
8h 35m
Chinese
China Machine Press
Content preview from 算法技术手册(原书第2 版)
37
3
算法基础
虽说开发软件是为了解决问题,但程序员们往往太执着于是否能够解决问题本身,而不
去确认这一问题是否已有解决之法。即便程序员们知道前人已在类似情况下解决了问题
但“已有的解决之法最终是否适用于特写的问题仍是一个未知数。更重要的是,要找
到完全不需要修改或者只需要稍作修改便能解决手头问题的代码并不容易
不同的人对待算法的态度各有千秋。很多人就只是简单地在一本书中或者网站上找个算
法,复制代码,运行一,然后可能还会测试一,如果结果正确就开始做下一个任务。
但是,在我们看来,这种使用方法无益于增进对算法的了解。事实上,这还有可能误导
今后的算法选择与实现。
所以问题便是如何为任何快速地选择正确的算法,并且有足够的自信确定自己的选择是
正确的。不仅如此,即便选择了正确的算法,如何高效实现又是另外一个问题。本书每
一章都讲述了一系列的算法来解决某个特定的问题(例如搜索或者排序)或者一类问题
(例如寻路)。本章将会阐述书中描述算法的通用格式,并总纳一些解决问题的常见方法。
3.1 算法模板的格式
使用模板来描述算法的好处在于可以很方便地对比各算法的相似和不同之处。本书
的每种算法都遵照模板格式使用固定的小节进行展示。如果某个小节不适用于当前算
法或者没有什么价值,就会略去。
3.1.1 名称
算法的描述性名称,用来方便区分其他算法。例如,当我们讨论
顺序搜索
时,这个名称
可准确表达所讨论的是哪种搜索算法。算法的名称永远用
粗体
表示。
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

Aurélien Géron
Go语言编程

Go语言编程

威廉·肯尼迪

Publisher Resources

ISBN: 9787111562221