contents

acknowledgments

about this book

about the author

about the cover illustration

Introduction

Who should read this book

How this book is organized: A roadmap

About the code

Other online resources

1 Small problems

The Fibonacci sequence

A first recursive attempt

Utilizing base cases

Memoization to the rescue

Keep it simple, Fibonacci

Generating Fibonacci numbers with a stream

Trivial compression

Unbreakable encryption

Getting the data in order

Encrypting and decrypting

Calculating pi

The Towers of Hanoi

Modeling the towers

Solving The Towers of Hanoi

Real-world applications

Exercises

2 Search problems

DNA search

Storing DNA

Linear search

Binary search

A generic example

Maze solving

Generating a random maze

Miscellaneous maze minutiae

Depth-first search

Breadth-first search

A* search

Missionaries and cannibals

Representing the problem

Solving

Real-world applications

Exercises

3 Constraint-satisfaction problems

Building a constraint-satisfaction problem framework

The Australian map-coloring problem

The eight queens problem

Word search

SEND+MORE=MONEY

Circuit board layout

Real-world applications

Exercises

4 Graph problems

A map as a graph

Building a graph framework

Working with Edge and UnweightedGraph

Finding the shortest path

Revisiting breadth-first search (BFS)

Minimizing the cost of building the network

Working with weights

Finding the minimum spanning tree

Finding shortest paths in a weighted graph

Dijkstra’s algorithm

Real-world applications

Exercises

5 Genetic algorithms

Biological background

A generic genetic algorithm

A naive test

SEND+MORE=MONEY revisited

Optimizing list compression

Challenges for genetic algorithms

Real-world applications

Exercises

6 K-means clustering

Preliminaries

The k-means clustering algorithm

Clustering governors by age and longitude

Clustering Michael Jackson albums by length

K-means clustering problems and extensions

Real-world applications

Exercises

7 Fairly simple neural networks

Biological basis?

Artificial neural networks

Neurons

Layers

Backpropagation

The big picture

Preliminaries

Dot product

The activation function

Building the network

Implementing neurons

Implementing layers

Implementing the network

Classification problems

Normalizing data

The classic iris data set

Classifying wine

Speeding up neural networks

Neural network problems and extensions

Real-world applications

Exercises

8 Adversarial search

Basic board game components

Tic-tac-toe

Managing tic-tac-toe state

Minimax

Testing minimax with tic-tac-toe

Developing a tic-tac-toe AI

Connect Four

Connect Four game machinery

Improving minimax with alpha-beta pruning

Minimax improvements beyond alpha-beta pruning

Real-world applications

Exercises

9 Miscellaneous problems

The knapsack problem

The Traveling Salesman Problem

The naive approach

Taking it to the next level

Phone number mnemonics

Real-world applications

Exercises

10 Interview with Brian Goetz

appendix A Glossary

appendix B More resources

index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.6.75