目录
第1章算法概述(Chapter 1Algorithm Overview)1
1.1算法及算法描述(Algorithm and its Description)1
1.1.1算法概念(Algorithm Concept)1
1.1.2算法的描述方法(Description of Algorithm)2
1.1.3算法评价(Algorithm Evaluation)7
1.2基本数据结构(Basic Data Structure)8
1.2.1顺序表与链表(Sequential List and Linked List)8
1.2.2栈与队列(Stack and Queue)11
1.2.3树与图(Structure of Tree and Diagram)13
1.3算法设计(Algorithm Design)18
1.3.1算法与程序(Algorithms and Programs)18
1.3.2算法设计原则(Algorithm Design Principle)19
习题1(Exercises One)21
第2章贪心算法(Chapter 2Greedy Algorithm)22
2.1概述(Overview)22
2.1.1算法思想(Algorithm Idea)22
2.1.2算法的设计与描述(Algorithm Design and Description)24
2.2活动安排问题(Event Scheduling Problem)25
2.2.1问题描述与分析(Problem Description and Analysis)25
2.2.2算法的设计(Algorithm Design)26
2.2.3算法实现(Algorithm Implementation)28
2.3最短路径问题(Shortest Path Problem)30
2.3.1基本思想(Basic Idea)30
2.3.2算法的设计与描述(Algorithm Design and Description)31
2.3.3算法实现(Algorithm Implementation)32
2.4哈夫曼编码(Huffman Coding)40
2.4.1基本思想 (Basic Idea)40
2.4.2算法的设计与描述(Algorithm Design and Description)41
2.4.3算法实现 (Algorithm Implementation)42
2.5最小生成树(Minimum Spanning Tree,MST)46
2.5.1基本思想(Basic Idea)46
2.5.2问题分析(Problem Analysis)47
2.5.3Prim算法(Prim Algorithm)48
2.5.4Kruskal算法(Kruskal Algorithm)54
2.6背包问题(Knapsack Problem)59
2.6.1基本思想(Basic Idea)59
2.6.2算法的设计与描述(Algorithm Design and Description)59
2.6.3算法实现(Algorithm Implementation)61
习题2(Exercises Two)62
第3章分治算法(Chapter 3DivideandConquer Algorithm)64
3.1概述(Overview)64
3.1.1基本思想(Basic Idea)64
3.1.2算法的本质(Nature of Algorithm)65
3.1.3算法的解题步骤(Algorithm Solution Steps)65
3.1.4分治与递归(DivideandConquer and Recursion)66
3.2排序问题算法(Sorting Problem Algorithm)67
3.2.1合并排序算法(Merge Sort Algorithm)67
3.2.2快速排序算法(Quick Sort Algorithm)73
3.3查找问题算法(Search Problem Algorithm)81
3.3.1顺序查找(Sequential Search)81
3.3.2折半查找算法(Binary Search Algorithm)84
3.4组合问题算法(Combinatorial Problem Algorithm)88
3.4.1最大子段和问题(Maximum Subsegment Sum Problem)88
3.4.2棋盘覆盖问题(Chessboard Covering Problem)94
3.5循环赛日程表(Round Robin Schedule)100
3.5.1算法思想(Algorithm Idea)100
3.5.2算法设计与描述(Algorithm Design and Description)101
3.5.3算法实现(Algorithm Implementation)102
习题3(Exercises Three)105
第4章动态规划算法(Chapter 4Dynamic Programming Algorithm)107
4.1概述(Overview)107
4.1.1基本思想(Basic Idea)108
4.1.2算法的解题步骤(Algorithm Solution Steps)108
4.1.3动态规划的基本要素(Essential Elements of Dynamic
Programming)109
4.2矩阵连乘问题(Matrix Multiplication Problem)111
4.2.1问题分析(Problem Analysis)111
4.2.2算法设计与描述(Algorithm Design and Description)112
4.2.3算法实现(Algorithm Implementation)113
4.3最长公共子序列问题(Longest Common Subsequence Problem)118
4.3.1问题分析(Problem Analysis)118
4.3.2算法设计与描述(Algorithm Design and Description)119
4.3.3算法实现(Algorithm Implementation)120
4.40/1背包问题(0/1 Knapsack Problem)126
4.4.1问题分析(Problem Analysis)126
4.4.2算法设计与描述(Algorithm Design and Description)127
4.4.3算法实现(Algorithm Implement)128
4.5最优二叉查找树问题(Optimal Binary Search Tree Problem)132
4.5.1问题分析(Problem Analysis)132
4.5.2算法设计与描述(Algorithm Design and Description)133
4.5.3算法实现(Algorithm Implementation)135
习题4(Exercises Four)140
第5章回溯算法(Chapter 5Backtracking Algorithm )142
5.1概述(Overview)142
5.1.1基本思想(Basic Idea)142
5.1.2算法的适用条件(Applicable Conditions of the Algorithm)145
5.1.3算法的效率估计(Efficiency Estimation of Algorithm)146
5.20/1背包问题(0/1 Knapsack Problem)147
5.2.1基本思想(Basic Idea)147
5.2.2算法设计与描述(Algorithm Design and Description)149
5.2.3算法实现(Algorithm Implementation)151
5.3n皇后问题(nqueens Problem)152
5.3.1基本思想(Basic Idea)152
5.3.2算法设计与描述(Algorithm Design and Description)153
5.3.3算法实现(Algorithm Implementation)155
5.4最大团问题(Maximum Clique Problem)157
5.4.1基本思想(Basic Idea)157
5.4.2算法设计与描述(Algorithm Design and Description)157
5.4.3算法实现(Algorithm Implementation)158
5.5图的m着色问题(The MColoring Problem of Graph)159
5.5.1基本思想(Basic Idea)160
5.5.2算法设计与描述(Algorithm Design and Description)161
5.5.3算法实现(Algorithm Implementation)163
习题5(Exercises Five)164
第6章分支限界算法(Chapter 6Branch and Bound Algorithm)166
6.1概述(Overview)166
6.20/1背包问题(0/1 Knapsack Problem)167
6.2.1基本思想(Basic Idea)167
6.2.2算法设计(Algorithm Design)168
6.2.3算法实现(Algorithm Implementation)170
6.3旅行商问题(Traveling Salesman Problem)181
6.3.1基本思想(Basic Idea)181
6.3.2算法设计与描述(Algorithm Design and Description)182
6.3.3算法实现(Algorithm Implementation)184
6.4布线问题(Wiring Problem)193
6.4.1基本思想(Basic Idea)193
6.4.2算法设计与描述(Algorithm Design and Description)194
6.4.3算法实现(Algorithm Implementation)196
习题6(Exercises Six)201
第7章图算法(Chapter 7Graph Algorithm)202
7.1概述(Overview)202
7.2图的表示(Representation of Graph)203
7.2.1直接存边(Direct Edge)204
7.2.2邻接表(Adjacency List)204
7.2.3邻接矩阵(Adjacency Matrix)205
7.2.4链式前向星(Chain Forward Star)207
7.3图的遍历(Traversing Graph)209
7.3.1广度优先搜索(Breadth First Search,BFS)210
7.3.2深度优先搜索(Depth First Search,DFS)211
7.4Dijkstra算法(Dijkstra Algorithm)213
7.4.1基本思想(Basic Idea)213
7.4.2算法实例(Algorithm Example)214
7.5BellmanFord算法(BellmanFord Algorithm)218
7.5.1基本思想(Basic Idea)218
7.5.2算法实例(Algorithm Example)219
7.6FloydWarshall算法(FloydWarshall Algorithm)223
7.6.1基本思想(Basic Idea)223
7.6.2算法实例(Algorithm Example)224
习题7(Exercises Seven)227
第8章概率分析和随机算法(Chapter 8Probability Analysis and
Stochastic Algorithm)2288.1概率分析(Probability Analysis)229
8.1.1概率分析方法(Probability Analysis Method)229
8.1.2分析步骤(Analysis Procedure)230
8.1.3实例演示(Example Demonstration)232
8.2随机方法(Stochastic Method)233
8.2.1随机抽样(Random Sampling)233
8.2.2四种常见的随机算法(Four Common Stochastic Algorithms)235
8.2.3随机数发生器(Random Number Generator)237
8.3数值随机化算法(Numerical Randomization Algorithm)238
8.3.1计算圆周率(Calculate Circular Constant)238
8.3.2计算定积分(Compute Definite Integral)240
8.3.3解非线性方程组(Solving Nonlinear Equations)241
8.4蒙特卡洛算法(Monte Carlo Algorithm)243
8.4.1基本思想(Basic Idea)243
8.4.2主元素问题(Principal Element Problem)244
8.4.3素数测试(Prime Number Test)245
8.5拉斯维加斯算法(Las Vegas Algorithm)249
8.5.1算法原理(Principle of Algorithm)249
8.5.2整数因子分解(Integer Factorization)250
8.5.3n皇后问题(nQueen Problem)252
8.6舍伍德算法(Sherwood Algorithm)254
8.6.1随机快速排序(Random Quicksort)254
8.6.2线性时间选择(Linear Time Selection)255
习题8(Exercises Eight)257
参考文献258
