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...
(展开全部)
APPLESAND 吴珍英Blog.naver.com/creamsand有一个梦想成为画家的少女!时间流逝,只是比其他人稍微手巧一些的她,成为了一名平凡的家庭...
奇葩大会2特别人类,马东推荐,坦桑尼亚总统作序!收入捐赠猎豹保护中心林迪朴素简陋的生活,塞卢斯惊险的旅程,央视直播艰辛的工作,初次见到大捻,初次被猎豹信任,初次...
常见病验方选编 中医验方汇编第一辑 本书特色 中国医药学是我国劳动人民几千年来同疾病作斗争丰富经验的总结,它是一个伟大的宝库。蕴藏在广大人民群众中的单方、验方,...
比登天还难的控枪路-持枪权与美国宪法第二修正案研究 本书特色 《比登天还难的控枪路--持枪权与美国宪法第二修正案研究》是中国学者撰写的**部系统研究美国...
病理科主治医生734 问 内容简介 本书不是一本病理诊断工作手册,也不是一本系统的诊断病理学参考书。病理诊断工作面对临床各科,人体疾病种类如何繁多,作为一名病理...
杰西卡·米特福德(Jessica Mitford,1917—1996 ),英国出生的著名作家、记者,以其对美国社会各方面的深入调查和批判闻名。1963年,她的第...
安德鲁·朗(Andrew Lang,1844—1912),英国作家、学者,著述涉及文学、历史、宗教、神话与民间传说等多个领域,而以搜集、整理的《彩色童话集》最为...
【编辑推荐】★ 通过科学实验的形式教会孩子一种学习方法,将科学,技术,工程和数学四大知识点融为一体!★ 打通各学科之间的联系,帮助孩子形成较强的思辨能力;★ 每...
【内容简介】这本书是台湾广告鬼才叶明桂先生在广告界深耕30余年后,首度著书讲述广告创意、品牌服务之道。对这本书的内容及价值,叶明桂先生这样说:我在奥美广告工作超...
《冲突与解决》提供了十分有用的技巧,它重新定义我们在家庭中和工作场所彼此的关联互动。当《冲突与解决》变成所有人的必读本时
实用五金手册 本书特色 《实用五金手册》反映当代五金产品领域*新科学技术成果,涵盖金属材料、机械五金、建筑五金、五金工具:各种五金产品品牌、尺寸、规格、成分、性...
什么是我们一生中耗时最多、最费心力的事?是做出大大小小的决策。但是,我们往往深陷难以计数的偏见和非理性中,做出荒谬的判断。该书阐述了如何通过助推在不需要强迫的情...
中医脐疗大全 本书特色 自1992年出版的《中医脐疗大全》(*版)问世以来,受到了广大读者的热烈欢迎与抬爱,也得到了许多中医和外治专家的认可,认为该书对古老脐疗...
《看破不说破》内容简介:该书收录了胡适研究中国禅宗思想的精华文章,虽然胡适本人不信任何宗教,但他对禅宗的见解,对于那些从事
作品目录分镜的作用时间的掌握内景和外景场景、镜头和镜次主观和客观摄像机的选择方法画面尺寸和构图故事的构想数码单反电影制作
原著:施耐庵,字肇瑞,号子安,元末明初小说家,代表作品《水浒传》。策划:一米阳光童书馆成立于2012年8月,是北京阳光博客童书子品牌,以“每一本好书,都是照进孩...
秘鲁自由与民主学会主席。该学会总部位于秘鲁首都利马,经济学家将其列为世界上两个最重要的智囊团之一。索托被时代和福布斯杂志称为世界上最具号召力的改革家之一。如今,...
《国家为什么会失败》回答了困扰专家们几个世纪的问题:为什么有的国家富、有的国家穷;国家为什么按照富裕不富裕、健康不健康、食物充足不充足来划分?是文化、天气、地理...
辉格,本名周飙,1970年生,浙江嘉兴人,1993年毕业于清华大学经济管理学院,曾长期以自由程序员为业,2008年受聘为《21世纪经济报道》评论员,开有独立博客...
★ “随你的心愿去做吧,但是不要让任何人当你的审判员。”★“美国戏剧的良心”阿瑟•米勒代表作,1953年托尼奖最佳剧本★著名翻译家、阿瑟·米勒译介第一人梅绍武先...