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...
(展开全部)
本书详细梳理了美国创新的重要历史,并对当下的处境表示了担忧,对未来提出了具体可行的策略支撑。本书的开头部分,聚焦公费资助的科学创新如何为第二次世界大战的胜利做出...
夜森曾用名夜夜森森。宅女,爱吃,爱睡,爱美剧。喜欢下雨前躺在草地上看云,半夜开车去山上看星星。曾经梦想做一个电影导演,后来发现欠缺科学缜密的头脑,智商只够用来幻...
宁不远(曾用名:宁远 )四川籍,现居成都。作家,生活美学家,曾是电视台主持人。中国原创服装品牌“远家YUANJIA”主理人。曾出版绘本《远远的村庄》,散文集《素...
村上春树(MURAKAMI HARUKI)1949年生于日本京都。日本著名作家。毕业于早稻田大学文学部。1979年以处女作《且听风吟》获得群像新人文学奖。主要著...
记述了主人公乔治•韦伯的成长过程:从美国南方的乡间小镇来到大都市纽约打拼,费尽心血写成的小说遭到出版商的冷落;爱上了有妇之
霍华德·舒尔茨,星巴克之父。霍华德·舒尔茨在布鲁克林的廉租房中长大,是家里第一个拿到大学文凭的人。在创办了小型咖啡馆“天天咖啡”后,他买下了星巴克。在他的领导下...
凤凰网“鼎力推鉴”主讲人王鼎杰全新力作,打破通史套路,摒弃娱乐戏说:★复盘七强生死牌局,跳出同盟国、轴心国阵营的正邪二分法,全面描绘七强国纵横捭阖的历史过程。★...
布坎南的這本《自由的界限》發表於1975年,是他少有的幾部獨立發表的專著。該書篇幅雖不大,卻系統總結了公共選擇理論的基本理念﹑思路和核心觀點,讀者不僅可以從中看...
玛格丽特·杜拉斯(Marguerite Duras,1914-1996),法国小说家、剧作家、电影导演,本名玛格丽特·多纳迪厄,出生于印度支那,在那里度过生命最...
蝴蝶蓝,阅文集团著名作家,被誉为“网游文神级大师”,江湖人称“虫爹”。作品幽默诙谐,人物性格鲜明,拥有众多死忠粉,尤其在年轻一代中人气超高,深受追捧。代表作《全...
精彩摘录①细石器阶段细石器≠磨制石器华北地区的两大旧石器文化传统1大石片砍斫器-三棱大尖状器传统——采集2船底形刮削器-雕刻
作品目录Chapter 1. 抹去了的過去Chapter 2. 律師的法則Chapter 3. 511孤兒院Chapter 4. 計劃Chapter 5. 小實...
The introduction of elections to district advisory bodies during the early 1980s...
裂隙岩体的流固耦合传热机理及其应用 本书特色 张树光、李永靖编写的这本《裂隙岩体的流固耦合传热机理及其应用》以深部开采所面临的岩体高温这一亟待解决的工程实际为背...
李恩中西医结合学术思想研究 本书特色 《李恩中西医结合学术思想研究》回顾中西医结合五十年的历史,展望中西医结合未来发展前景。李恩中西医结合学术思想研究 内容简介...
《白色绵羊里的黑色绵羊》是双雪涛的首部杂文集。全书分为三个部分:第一部分“白色绵羊里的黑色绵羊:谈小说”,收录了作者面向写作爱好者的九篇专文:从小说的开头、氛围...
安德鲁·兰伯特(Andrew Lambert),英国历史学家,伦敦国王学院劳顿教席(为纪念知名的世界海军史学家约翰·劳顿教授创建)教授,英国皇家历史学会成员,海...
This book offers robust solutions for everyday programming tasks, providing all ...
李智慧曾在阿里巴巴担任技术专家,参与阿里巴巴基础技术平台开发和www.alibaba.com架构设计。目前就职英特尔亚太研发中心从事云计算与大数据方面的研发工作...
长沙古本伤寒杂病论 本书特色 由张仲景所著的《长沙古本伤寒杂病论》,亦称《湘古本》,与《桂林古本》及《涪陵古本》(《四川古本》)并为东汉张仲景所著《伤寒杂病论》...