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 版)
7
1
用算法的眼光去看问题
算法真的是非常重要!算法的选择会对软件性能产生巨大影响。本书将指导你学习一
系列的算法,例如搜索和排序,还会介绍一些算法经常采用的策略,例如分治贪心。
希望从此之后,你能够灵活运用这些算法来改善软件的性能。
自“计算”出现之后,数据结构便一直与算法紧密相关。本书将介绍一些基本的数据结构,
并展示如何使用这些数据结构来高效地处理数据。
在选择算法时,你需要做什么?我们将在接下来的章节中探究这个问题的答案。
1.1 理解问题
设计算法的第一步就是理解将要解决的问题。以一个计算几何领域简单问题为例:给
定一个二维点集
P
(见
1-1
,想象用一个橡皮圈把这些点围起来,松开之后,这个
橡皮圈的形状就是
凸包
(能够把点集
P
所有的点全部包围起来的最小凸形)。那么,现
在的任务就是编写一个算法,针对一个给定的二维点集,计算它的凸包。
仔细观察点集
P
的凸包就会发现,连接
P
中任何两点的线段都位于这个凸包内。假设,
我们把凸包中的点按顺时针排好,不难发现,这个凸包其实是由
h
个顺时针排列的点
L
0
,
L
1
, ...,
L
h
-1
组成,如图
1-2
所示。每三个相邻的点
L
i
,
L
i
+1
,
L
i+
2
组成一个向右拐的线条。
有了这样的信息,也许你可以手工画出任意点集的凸包,但是否能写出一个算法呢(给
出一系列循序渐进的指令,并且能够高效地计算出任意点集的凸包)?
有趣之处在于,这个凸包问题貌似并不属于任何众所周知的算法范畴。而且,似乎也并
没有任何线性时间的排序算法能够按照从左到右顺时针对点进行排序与此类似,要找 ...
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