Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion episodes/computation_programming.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,23 @@ exercises: 10

*Decomposition* is crucial in any kind of problem breakdown, but especially so in programming. The computer must be told **precisely** what to do, and in what order, so problems must be broken down into discrete parts and each section coded appropriately.

Suppose we want to find the ten words most commonly used in a text. How might we go about that?
#### Defining Inputs and Outputs

Before we can tell the computer *what* to do (the algorithm), we must clarify *what data* we are working with. Every computational problem involves a transformation:

1. **Input:** What is the starting state? What data do we have? What format is it in?
2. **Output:** What is the desired goal? What should the result look like?

If we don't define these clearly, we cannot design effective steps to bridge the gap.

Suppose we want to find the ten words most commonly used in a text.

**Input:** A digital text file (e.g., a book chapter).
**Output:** A list of the top 10 most frequent words.

The *process* (or algorithm) is the series of steps that turns that specific Input into that specific Output.

How might we go about that?

#### Linear code

Expand Down