Classic Computer Science Problems in Java

Book description

Classic Computer Science Problems in Java is a master class in computer programming designed around 55 exercises that have been used in computer science classrooms for years. You’ll work through hands-on examples as you explore core algorithms, constraint problems, AI applications, and much more.

Table of contents

  1. Classic Computer Science Problems in Java
  2. Copyright
  3. contents
  4. front matter
    1. acknowledgments
    2. about this book
      1. liveBook discussion forum
    3. about the author
    4. about the cover illustration
  5. Introduction
    1. Who should read this book
    2. How this book is organized: A roadmap
    3. About the code
    4. Other online resources
  6. 1 Small problems
    1. 1.1 The Fibonacci sequence
      1. 1.1.1 A first recursive attempt
      2. 1.1.2 Utilizing base cases
      3. 1.1.3 Memoization to the rescue
      4. 1.1.4 Keep it simple, Fibonacci
      5. 1.1.5 Generating Fibonacci numbers with a stream
    2. 1.2 Trivial compression
    3. 1.3 Unbreakable encryption
      1. 1.3.1 Getting the data in order
      2. 1.3.2 Encrypting and decrypting
    4. 1.4 Calculating pi
    5. 1.5 The Towers of Hanoi
      1. 1.5.1 Modeling the towers
      2. 1.5.2 Solving The Towers of Hanoi
    6. 1.6 Real-world applications
    7. 1.7 Exercises
  7. 2 Search problems
    1. 2.1 DNA search
      1. 2.1.1 Storing DNA
      2. 2.1.2 Linear search
      3. 2.1.3 Binary search
      4. 2.1.4 A generic example
    2. 2.2 Maze solving
      1. 2.2.1 Generating a random maze
      2. 2.2.2 Miscellaneous maze minutiae
      3. 2.2.3 Depth-first search
      4. 2.2.4 Breadth-first search
      5. 2.2.5 A* search
    3. 2.3 Missionaries and cannibals
      1. 2.3.1 Representing the problem
      2. 2.3.2 Solving
    4. 2.4 Real-world applications
    5. 2.5 Exercises
  8. 3 Constraint-satisfaction problems
    1. 3.1 Building a constraint-satisfaction problem framework
    2. 3.2 The Australian map-coloring problem
    3. 3.3 The eight queens problem
    4. 3.4 Word search
    5. 3.5 SEND+MORE=MONEY
    6. 3.6 Circuit board layout
    7. 3.7 Real-world applications
    8. 3.8 Exercises
  9. 4 Graph problems
    1. 4.1 A map as a graph
    2. 4.2 Building a graph framework
      1. 4.2.1 Working with Edge and UnweightedGraph
    3. 4.3 Finding the shortest path
      1. 4.3.1 Revisiting breadth-first search (BFS)
    4. 4.4 Minimizing the cost of building the network
      1. 4.4.1 Working with weights
      2. 4.4.2 Finding the minimum spanning tree
    5. 4.5 Finding shortest paths in a weighted graph
      1. 4.5.1 Dijkstra’s algorithm
    6. 4.6 Real-world applications
    7. 4.7 Exercises
  10. 5 Genetic algorithms
    1. 5.1 Biological background
    2. 5.2 A generic genetic algorithm
    3. 5.3 A naive test
    4. 5.4 SEND+MORE=MONEY revisited
    5. 5.5 Optimizing list compression
    6. 5.6 Challenges for genetic algorithms
    7. 5.7 Real-world applications
    8. 5.8 Exercises
  11. 6 K-means clustering
    1. 6.1 Preliminaries
    2. 6.2 The k-means clustering algorithm
    3. 6.3 Clustering governors by age and longitude
    4. 6.4 Clustering Michael Jackson albums by length
    5. 6.5 K-means clustering problems and extensions
    6. 6.6 Real-world applications
    7. 6.7 Exercises
  12. 7 Fairly simple neural networks
    1. 7.1 Biological basis?
    2. 7.2 Artificial neural networks
      1. 7.2.1 Neurons
      2. 7.2.2 Layers
      3. 7.2.3 Backpropagation
      4. 7.2.4 The big picture
    3. 7.3 Preliminaries
      1. 7.3.1 Dot product
      2. 7.3.2 The activation function
    4. 7.4 Building the network
      1. 7.4.1 Implementing neurons
      2. 7.4.2 Implementing layers
      3. 7.4.3 Implementing the network
    5. 7.5 Classification problems
      1. 7.5.1 Normalizing data
      2. 7.5.2 The classic iris data set
      3. 7.5.3 Classifying wine
    6. 7.6 Speeding up neural networks
    7. 7.7 Neural network problems and extensions
    8. 7.8 Real-world applications
    9. 7.9 Exercises
  13. 8 Adversarial search
    1. 8.1 Basic board game components
    2. 8.2 Tic-tac-toe
      1. 8.2.1 Managing tic-tac-toe state
      2. 8.2.2 Minimax
      3. 8.2.3 Testing minimax with tic-tac-toe
      4. 8.2.4 Developing a tic-tac-toe AI
    3. 8.3 Connect Four
      1. 8.3.1 Connect Four game machinery
      2. 8.3.2 A Connect Four AI
      3. 8.3.3 Improving minimax with alpha-beta pruning
    4. 8.4 Minimax improvements beyond alpha-beta pruning
    5. 8.5 Real-world applications
    6. 8.6 Exercises
  14. 9 Miscellaneous problems
    1. 9.1 The knapsack problem
    2. 9.2 The Traveling Salesman Problem
      1. 9.2.1 The naive approach
      2. 9.2.2 Taking it to the next level
    3. 9.3 Phone number mnemonics
    4. 9.4 Real-world applications
    5. 9.5 Exercises
  15. 10 Interview with Brian Goetz
  16. Appendix A. Glossary
  17. Appendix B. More resources
    1. Java
    2. Data structures and algorithms
    3. Artificial intelligence
    4. Functional programming
  18. index

Product information

  • Title: Classic Computer Science Problems in Java
  • Author(s): David Kopec
  • Release date: January 2021
  • Publisher(s): Manning Publications
  • ISBN: 9781617297601