HOW TO THINK ABOUT ALGORITHMS
There are many algorithm texts that provide lots of well-polished code and
proofs of correctness. Instead, this one presents insights, notations, and
analogies to help the novice describe and think about algorithms like an
expert. It is a bit like a carpenter studying hammers instead of houses. Jeff
Edmonds provides both the big picture and easy step-by-step methods for
developing algorithms, while avoiding the comon pitfalls. Paradigms such
as loop invariants and recursion help to unify a huge range of algorithms
into a few meta-algorithms. Part of the goal is to teach students to think
abstractly. Without getting bogged down in formal proofs, the book fosters
deeper understanding so that how and why each algorithm works is trans-
parent. These insights are presented in a slow and clear manner accessible
to second- or third-year students of computer science, preparing them to
find on their own innovative ways to solve problems.
Abstraction is when you translate the equations, the rules, and the under-
lying essences of the problem not only into a language that can be commu-
nicated to your friend standing with you on a streetcar, but also into a form
that can percolate down and dwell in your subconscious. Because, remem-
ber, it is your subconscious that makes the miraculous leaps of inspiration,
not your plodding perspiration and not your cocky logic. And remember,
unlike you, your subconscious does not understand Java code.
Bookmarks
Cover
Half-title
Title
Copyright
CONTENTS
PREFACE
Introduction
PART ONE:Iterative Algorithms and Loop Invariants
1 Iterative Algorithms: Measures of Progress and Loop Invariants
1.1 A Paradigm Shift: A Sequence of Actions vs. a Sequence of Assertions
1.2 The Steps to Develop an Iterative Algorithm
1.3 More about the Steps
1.4 Different Types of Iterative Algorithms
1.5 Typical Errors
1.6 Exercises
2 Examples Using More-of-the-Input Loop Invariants
2.1 Coloring the Plane
2.2 Deterministic Finite Automaton
2.3 More of the Input vs. More of the Output
3 Abstract Data Types
3.1 Specifications and Hints at Implementations
3.2 Link List Implementation
3.3 Merging with a Queue
3.4 Parsing with a Stack
4 Narrowing the Search Space: Binary Search
4.1 Binary Search Trees
4.2 Magic Sevens
4.3 VLSI Chip Testing
4.4 Exercises
5 Iterative Sorting Algorithms
5.1 Bucket Sort by Hand
5.2 Counting Sort (a Stable Sort)
5.3 Radix Sort
5.4 Radix Counting Sort
6 Euclid’s GCD Algorithm
7 The Loop Invariant for Lower Bounds
PART TWO: Recursion
8 Abstractions, Techniques, and Theory
8.1 Thinking about Recursion
8.2 Looking Forward vs. Backward
8.3 With a Little Help from Your Friends
8.4 The Towers of Hanoi
8.5 Checklist for Recursive Algorithms
8.6 The Stack Frame
8.7 Proving Correctness with Strong Induction
9 Some Simple Examples of Recursive Algorithms
9.1 Sorting and Selecting Algorithms
9.2 Operations on Integers
9.3 Ackermann's Function
9.4 Exercises
10 Recursion on Trees
10.1 Tree Traversals
10.2 Simple Examples
10.3 Generalizing the Problem Solved
10.4 Heap Sort and Priority Queues
10.5 Representing Expressions with Trees
11 Recursive Images
11.1 Drawing a Recursive Image from a Fixed Recursive and a Base Case Image
11.2 Randomly Generating a Maze
12 Parsing with Context-Free Grammars
PART THREE: Optimization Problems
13 Definition of Optimization Problems
14 Graph Search Algorithms
14.1 A Generic Search Algorithm
14.2 Breadth-First Search for Shortest Paths
14.3 Dijkstra's Shortest-Weighted-Path Algorithm
14.4 Depth-First Search
14.5 Recursive Depth-First Search
14.6 Linear Ordering of a Partial Order
14.7 Exercise
15 Network Flows and Linear Programming
15.1 A Hill-Climbing Algorithm with a Small Local Maximum
15.2 The Primal…Dual Hill-Climbing Method
15.3 The Steepest-Ascent Hill-Climbing Algorithm
15.4 Linear Programming
15.5 Exercises
16 Greedy Algorithms
16.1 Abstractions, Techniques, and Theory
16.2 Examples of Greedy Algorithms 16.2.1 Example: The Job/Event Scheduling Problem
16.2.2 Example: The Interval Cover Problem
16.2.3 Example: The Minimum-Spanning-Tree Problem
16.3 Exercises
17 Recursive Backtracking
17.1 Recursive Backtracking Algorithms
17.2 The Steps in Developing a Recursive Backtracking
17.3 Pruning Branches
17.4 Satisfiability
17.5 Exercises
18 Dynamic Programming Algorithms
18.1 Start by Developing a Recursive Backtracking
18.2 The Steps in Developing a Dynamic Programming Algorithm
18.3 Subtle Points
18.3.1 The Question for the Little Bird
18.3.2 Subinstances and Subsolutions
18.3.3 The Set of Subinstances
18.3.4 Decreasing Time and Space
18.3.5 Counting the Number of Solutions
18.3.6 The New Code
19 Examples of Dynamic Programs
19.1 The Longest-Common-Subsequence Problem
19.2 Dynamic Programs as More-of-the-Input Iterative Loop Invariant Algorithms
19.3 A Greedy Dynamic Program: The Weighted Job/Event Scheduling Problem
19.4 The Solution Viewed as a Tree: Chains of Matrix Multiplications
19.5 Generalizing the Problem Solved: Best AVL Tree
19.6 All Pairs Using Matrix Multiplication
19.7 Parsing with Context-Free Grammars
19.8 Designing Dynamic Programming Algorithms via Reductions
20 Reductions and NP-Completeness
20.1 Satisfiability Is at Least as Hard as Any Optimization Problem
20.2 Steps to Prove NP-Completeness
20.3 Example: 3-Coloring Is NP-Complete
20.4 An Algorithm for Bipartite Matching Using the Network Flow Algorithm
21 Randomized Algorithms
21.1 Using Randomness to Hide the Worst Cases
21.2 Solutions of Optimization Problems with a Random Structure
PART FOUR: Appendix
22 Existential and Universal Quantifiers
23 Time Complexity
23.1 The Time (and Space) Complexity of an Algorithm
23.2 The Time Complexity of a Computational Problem
24 Logarithms and Exponentials
25 Asymptotic Growth
25.1 Steps to Classify a Function
25.2 More about Asymptotic Notation
26 Adding-Made-Easy Approximations
26.1 The Technique
26.2 Some Proofs for the Adding-Made-Easy Technique
27 Recurrence Relations
27.1 The Technique
27.2 Some Proofs
28 A Formal Proof of Correctness
PART FIVE: Exercise Solutions
Chapter 1. Iterative Algorithms: Measures of Progress and Loop Invariants
Chapter 2. Examples UsingMore-of-the-Input Loop Invariant
Chapter 3. Abstract Data Types
Chapter 4. Narrowing the Search Space: Binary Search
Chapter 6. Euclid’s GCD Algorithm
Chapter 7. The Loop Invariant for Lower Bounds
Chapter 8. Abstractions, Techniques, and Theory
Chapter 9. Some Simple Examples of Recursive Algorithms
Chapter 10. Recursion on Trees
Chapter 11. Recursive Images
Chapter 12. Parsingwith Context-Free Grammars
Chapter 14. Graph Search Algorithms
Chapter 15. Network Flows and Linear Programming
Chapter 16: Greedy Algorithms
Chapter 17. Recursive Backtracking
Chapter 18. Dynamic Programming Algorithms
Chapter 19. Examples of Dynamic Programs
Chapter 20. Reductions and NP-Completeness
Chapter 22. Existential and Universal Quantifiers
Chapter 23. Time Complexity
Chapter 24. Logarithms and Exponentials
Chapter 25. Asymptotic Growth
Chapter 26. Adding-Made-Easy Approximations
Chapter 27. Recurrence Relations
CONCLUSION
INDEX
Jeff Edmonds received his Ph.D. in 1992 at University of Toronto in theoretical computer science. His thesis proved that certain computation problems require a given amount of time and space. He did his postdoctorate work at the ICSI in Berkeley on secure multi-media data transmission and in 1995 became an Associate Professor in the Department of Computer Science at York Univer...
(展开全部)
荷兰汉学家高罗佩重写初唐名臣狄仁杰传奇兼具中国古典文学雅韵与西方侦探小说妙趣-□全新无删减译本□高罗佩手绘插图□创作背景全解析□译者研究高罗佩多年,独自担纲翻译...
◣英国文坛三巨头之一朱利安•巴恩斯拷问爱情本质之作。◣朱利安•巴恩斯是布克奖得主,荣获17项世界文学大奖、5枚荣誉勋章,获奖记录横贯欧洲各国!◣巴恩斯以对历史、...
大山旬,日本超人气形象设计师。他长期致力于为普通人提供一读便懂的“穿衣法则”,教授实用穿搭术。曾经因为手把手成功改造众多日本普通人而被读卖新闻、日本放送协会、朝...
赵希岗,1989年毕业于中央工艺美术学院装潢设计系。2003年取得清华大学美术学院研究生硕士学位。现任教于清华大学美术学院。主要作品有:图书《现代图形设计》、图...
《佩蓉谈商务礼仪》与其他礼仪类图书最根本的不同是对动机的理解不同。出于恐惧的动机,让我们做出规避惩罚的行为;而出于实现特
牙及牙槽外科学 本书特色 由胡开进主编的《牙及牙槽外科学(供口腔医学 类专业用全国高等学校研究生规划教材)》围绕牙拔 除术、牙及牙槽骨损伤、修复前外科、口腔局部...
许慎(约58一约147),字叔重,东汉汝南召陵(今属河南漯河)人,著名经学家、文字学家,曾跟随大学者贾逵受学,博通经籍,号称“五经无双许叔重”。著有《说文解字》...
这本回忆录讲述了一行禅师的一生。每一个故事都是他真实的生活经历。他向我们展示全神贯注活在此时此刻的意义。如果你身处繁重的工作,感到焦虑或内心迷惘,无法获得平静与...
爱新觉罗·毓鋆(1906-2011) 清朝礼亲王代善裔孙,外界都敬称他为“毓老”而不名。毓老自幼受宫廷教育,末代皇帝溥仪伴读。师从陈宝琛、罗振玉、柯劭、王国维、...
诚邀爱“乱”画、爱天马行空的孩子,一起看设计。孩子会发现,司空见惯的日常物品,隐藏着奇特的一面:卧室是一座小岛,桌子是古希腊神庙,托盘是城市广场,椅子有手有脚有...
冯友兰(1895——1990)中国当代著名哲学家、教育家。1918年毕业于北京大学哲学系,1924年获美国哥伦比亚大学哲学博士学位。1952年后一直任北京大学哲...
"WebleyAirRifles"comprisesacomprehensivehistoryofalltheairriflesmadebythecompany...
木崎ちあきCHIAKI KISAKI福岡縣出身,出道第四年,右投右打。榮獲第二十屆「電擊小說大賞」之大賞,二○一四年出道。興趣是觀賞職業棒球比賽與外國連續劇,最...
【编辑推荐】★杰里米·里德所著传记《等待那个男人:卢·里德的人生与音乐》经全新修订,中文版重磅面世。★陈德政、郝舫、华东、健崔、刘敏、张有待、朱文博联袂推荐。★...
贪污罪专题整理 本书特色 《贪污罪专题整理》为北京师范大学刑事法律科学研究院·刑法学研究总整理文库丛书之一,由中国人民公安大学出版社出版。贪污罪专题整理 目录 ...
作品目录引言第一章 本我与角色之间:另一种可能性 《认》和《搭车游戏》解读第二章 错位和悖谬导演的性喜剧 《可笑的爱情》解读
1. 史学大家钱穆《国史大纲》课堂版,历经六十载传奇面世!2. 源于北大盛况空前的课堂、修订于西南联大、完备于香港新亚书院;被顾颉刚和牟宗三评价“课讲得很精彩”...
阿尔贝·加缪(Albert Camus,1913―1960),法国著名小说家、哲学家和戏剧家,出生于阿尔及利亚的蒙多维城。父亲在一战中阵亡后,他随母亲移居外祖母...
[内容简介]互联网时代,公共与隐私之间已经没有界限。PR 不再是公共关系的简称,PR是感知和现实。公关人的工作绝不仅仅是为客户隐藏秘密和处理危机。公关更多的是,...
与很多技术类书籍不同的是,《通信之美》不是简单地罗列知识点和代码,而是以专题的形式,由浅入深地讲解通信和信号处理相关的专业知识。《通信之美》在深入浅出的基础上,...