Acknowledgments |
|
xiii | |
About This Book |
|
xv | |
About The Author |
|
xvi | |
About The Cover Illustration |
|
xvii | |
Introduction |
|
1 | (6) |
|
0.1 Who should read this book |
|
|
2 | (1) |
|
0.2 How this book is organized: A roadmap |
|
|
3 | (1) |
|
|
4 | (1) |
|
0.4 Other online resources |
|
|
5 | (2) |
|
|
7 | (20) |
|
1.1 The Fibonacci sequence |
|
|
7 | (6) |
|
A first recursive attempt |
|
|
7 | (2) |
|
|
9 | (1) |
|
Memoization to the rescue |
|
|
10 | (2) |
|
Keep it simple, Fibonacci |
|
|
12 | (1) |
|
Generating Fibonacci numbers with a stream |
|
|
13 | (1) |
|
|
13 | (5) |
|
1.3 Unbreakable encryption |
|
|
18 | (3) |
|
Getting the data in order |
|
|
18 | (1) |
|
Encrypting and decrypting |
|
|
19 | (2) |
|
|
21 | (1) |
|
|
22 | (3) |
|
|
23 | (1) |
|
Solving The Towers of Hanoi |
|
|
23 | (2) |
|
1.6 Real-world applications |
|
|
25 | (1) |
|
|
26 | (1) |
|
|
27 | (32) |
|
|
27 | (8) |
|
|
27 | (3) |
|
|
30 | (1) |
|
|
31 | (2) |
|
|
33 | (2) |
|
|
35 | (17) |
|
|
37 | (1) |
|
Miscellaneous maze minutiae |
|
|
38 | (1) |
|
|
39 | (5) |
|
|
44 | (3) |
|
|
47 | (5) |
|
2.3 Missionaries and cannibals |
|
|
52 | (6) |
|
|
53 | (2) |
|
|
55 | (3) |
|
2.4 Real-world applications |
|
|
58 | (1) |
|
|
58 | (1) |
|
3 Constraint-Satisfaction Problems |
|
|
59 | (21) |
|
3.1 Building a constraint-satisfaction problem framework |
|
|
60 | (4) |
|
3.2 The Australian map-coloring problem |
|
|
64 | (3) |
|
3.3 The eight queens problem |
|
|
67 | (3) |
|
|
70 | (6) |
|
|
76 | (1) |
|
|
77 | (1) |
|
3.7 Real-world applications |
|
|
78 | (1) |
|
|
79 | (1) |
|
|
80 | (27) |
|
|
80 | (3) |
|
4.2 Building a graph framework |
|
|
83 | (6) |
|
Working with Edge and Unweighted Graph |
|
|
88 | (1) |
|
4.3 Finding the shortest path |
|
|
89 | (2) |
|
Revisiting breadth-first search (BFS) |
|
|
89 | (2) |
|
4.4 Minimizing the cost of building the network |
|
|
91 | (9) |
|
|
91 | (4) |
|
Finding the minimum spanning tree |
|
|
95 | (5) |
|
4.5 Finding shortest paths in a weighted graph |
|
|
100 | (5) |
|
|
100 | (5) |
|
4.6 Real-world applications |
|
|
105 | (1) |
|
|
106 | (1) |
|
|
107 | (21) |
|
5.1 Biological background |
|
|
107 | (1) |
|
5.2 A generic genetic algorithm |
|
|
108 | (8) |
|
|
116 | (2) |
|
5.4 SEND+MORE=MONEY revisited |
|
|
118 | (4) |
|
5.5 Optimizing list compression |
|
|
122 | (3) |
|
5.6 Challenges for genetic algorithms |
|
|
125 | (1) |
|
5.7 Real-world applications |
|
|
126 | (1) |
|
|
127 | (1) |
|
|
128 | (18) |
|
|
129 | (2) |
|
6.2 The k-means clustering algorithm |
|
|
131 | (7) |
|
6.3 Clustering governors by age and longitude |
|
|
138 | (4) |
|
6.4 Clustering Michael Jackson albums by length |
|
|
142 | (2) |
|
6.5 K-means clustering problems and extensions |
|
|
144 | (1) |
|
6.6 Real-world applications |
|
|
145 | (1) |
|
|
145 | (1) |
|
7 Fairly Simple Neural Networks |
|
|
146 | (30) |
|
|
147 | (1) |
|
7.2 Artificial neural networks |
|
|
148 | (6) |
|
|
148 | (1) |
|
|
149 | (1) |
|
|
150 | (4) |
|
|
154 | (1) |
|
|
154 | (2) |
|
|
154 | (1) |
|
|
155 | (1) |
|
|
156 | (7) |
|
|
157 | (1) |
|
|
158 | (2) |
|
|
160 | (3) |
|
7.5 Classification problems |
|
|
163 | (9) |
|
|
164 | (1) |
|
The classic iris data set |
|
|
165 | (4) |
|
|
169 | (3) |
|
7.6 Speeding up neural networks |
|
|
172 | (1) |
|
7.7 Neural network problems and extensions |
|
|
173 | (1) |
|
7.8 Real-world applications |
|
|
174 | (1) |
|
|
175 | (1) |
|
|
176 | (25) |
|
8.1 Basic board game components |
|
|
176 | (2) |
|
|
178 | (11) |
|
Managing tic-tac-toe state |
|
|
178 | (4) |
|
|
182 | (3) |
|
Testing minimax with tic-tac-toe |
|
|
185 | (2) |
|
Developing a tic-tac-toe AI |
|
|
187 | (2) |
|
|
189 | (9) |
|
Connect Four game machinery |
|
|
189 | (6) |
|
|
195 | (2) |
|
Improving minimax with alpha-beta pruning |
|
|
197 | (1) |
|
8.4 Minimax improvements beyond alpha-beta pruning |
|
|
198 | (1) |
|
8.5 Real-world applications |
|
|
199 | (1) |
|
|
200 | (1) |
|
|
201 | (17) |
|
|
201 | (5) |
|
9.2 The Traveling Salesman Problem |
|
|
206 | (7) |
|
|
207 | (6) |
|
Taking it to the next level |
|
|
213 | (1) |
|
9.3 Phone number mnemonics |
|
|
213 | (3) |
|
9.4 Real-world applications |
|
|
216 | (1) |
|
|
216 | (2) |
|
10 Interview With Brian Goetz |
|
|
218 | (14) |
Appendix A Glossary |
|
232 | (6) |
Appendix B More resources |
|
238 | (3) |
Index |
|
241 | |