# Contents

**Chapter 0**

*Ancient Greek Mathematics and the Foundations of Computational Thinking*

Algorithms, or methods used to solve problems, are the building blocks of computer science. Although computers are relatively new in human history, algorithms are not, and we will learn about two beautiful mathematical algorithms from ancient Greece. We will introduce the basics of pseudocode, which allows us to precisely describe complex algorithms. We will then introduce the basics of the Go programming language, use it to implement the ancient Greek algorithms, and time these algorithms compared to less elegant approaches.

**Chapter 1**

*Hunting for Hidden Messages in Bacterial Genomes Using String Algorithms*

Every organism on Earth has a genome, or the sum total of its cellular DNA. Your own genome has three billion nucleotides, or letters from the four symbol alphabet {`A`

, `C`

, `G`

, `T`

}. The genome of a bacterium typically has a few million nucleotides. How can we decipher the hidden messages that are lurking within our DNA? We will see that even relatively simple algorithms can provide deep insights into the life of a bacterium.

**Chapter** 2

*Forecasting a Presidential Election with Monte Carlo Simulation*

**Chapter**2

We will introduce a powerful paradigm called Monte Carlo simulation that incorporates randomness into many simulated trials in order to provide an estimated outcome. After understanding the complexities of generating random numbers, we will apply what we learn to simulate the 2016 US presidential election from polling data.

**Chapter** 3

*Discovering a Self-Replicating Cellular Automaton with Top-Down Programming*

**Chapter**3

Despite the many advances in AI and robotics, researchers have yet to build a robot that can both perform a complicated task and create a copy of itself. Yet the theoretical foundations of this idea lie decades in the past. We will introduce cellular automata, a simple model of cells, and after exploring one fun automaton called the Game of Life, we will see how to build a self-replicating automaton.