# Problem Solving

## The Big Problem

From the time you wake up in the morning to the time you go to sleep at night, you face problems of one sort or another throughout the day. Whether it’s the challenge of dragging yourself out of a cozy bed when you just want to keep sleeping, deciding what to wear for the day, making sure you arrive at each of your classes on time and with the proper materials, completing your assigned homework, or carrying on a texting conversation with your best friend, everything you do can be seen as a problem that you must solve.

Every task that you deal with on a day-to-day basis, no matter how large or small, requires that you perform a specific set of actions and make a particular set of decisions in very precise ways. And if you manage to perform the right sequence of steps in just the right order, you’ll succeed in achieving what you set out to accomplish. That is, you’ll have solved your problem.

## Executing Solutions

For example, the very act of reading this paragraph right now is a problem that you are currently solving, likely without even realizing that you’re solving a problem. Just a few moments ago, you had no idea what this paragraph was about, what it says, or what you’re supposed to be taking away from it. But as you started reading it, your mind began subconsciously following an algorithm that you were taught many years ago for solving just this very type of problem. First, your eyes focused on the upper left-hand corner of the block of text (i.e., where it says “For example"). Then your eyes scanned left to right across the text, noting the spaces that separated the various words and then decoding the meaning of each of those words as you encountered it. When your eyes reached the right-hand margin of a line of text, they dropped down to the next row and quickly repositioned themselves back on the left-hand margin. You then repeated this left-to-right scanning/decoding process line by line until you reach the end of the paragraph. And when you reach that point, without even thinking about how you were doing it, you will have actually solved the “big problem” of reading and, hopefully, comprehending this paragraph. Congratulations!

## Generalizing Problems

Also note that the algorithm you learned for reading the above paragraph (as well as this and every other paragraph) was a generalized algorithm. It wasn’t specific to the paragraph above. Instead, that single algorithm of scanning through the text of a paragraph word-by-word and line-by-line is perfectly applicable to any paragraph. Imagine how difficult life would be if it only worked for a single paragraph of text and that reading every other paragraph required its own unique set of instructions.

Instead, the mark of a good problem solver is the ability to use abstraction to generalize a variety of related problems and develop a common solution that can be applied to solve any of them. Much of computer science involves identifying these generalized solutions, codifying them in a programming language, and then letting a computer do all the work of executing your plan.

## Breaking it Down

Big problems are BIG! They’re hard. They’re challenging. They can be overwhelming. If they weren’t, we wouldn’t call them “big problems.” But, how does one solve a “big problem"?

The easy answer is that you don’t. DO NOT TRY TO SOLVE A BIG PROBLEM! At least not directly.

Smaller problems are much easier to handle. They’re simple. They’re easy. They’re trivial. Or at least they can be if you just make them small enough.

In fact, the best way to solve a big problem is to recognize that every big problem is really just a combination of many smaller problems. And those smaller problems, themselves, might be made up of even smaller problems that can be broken down even further until all you’re left with are a bunch of trivially simple problems that you already know how to solve.

And here’s the important thing to realize: If you can solve all of the small problems, you’ll have solved the big problem!

## Building Towers

The challenge is to take a good, long look at your big problem and try to reimagine it as a series of smaller problems. More than likely, you and your group members intuitively used some very clever problem-solving strategies despite whether you were aware of it.

For example, in the previous “Building Blocks” activity, you were tasked with building a series of precisely located towers, each with a specific set of properties. Building multiple towers simultaneously (big problem) is much more challenging than building a single tower (small problem). So, we can redefine the original problem (hard) as being equivalent to building a sequence of individual towers (easy).

Big Problem Redefined Problem
Build N towers Build 1st tower
Build 2nd tower
...
Build Nth tower

But even though building a single tower is an easier problem to solve than building multiple towers, it’s still a pretty big problem in and of itself. Perhaps we can break it down into even smaller problems.

Big Problem Redefined Problem
Build a tower of M blocks Place 1st block
Place 2nd block
...
Place Mth block

For each tower we want to build, we can think of that as merely placing a series of properly oriented blocks. But how might we break down the task of placing a block?

Big Problem Redefined Problem
Place a block Supply a block to X
Orient a block
Move a block into position

For each block, we only need to supply it, orient it, and move it into its final position. But “Supply a block to X” is one of the two actions the Supplier already knows how to do! And moving a block to a desired location is something the Worker already knows how to do! Two of the three steps to “Place a block” involve built-in functionality and there’s no need to redefine either of those steps any further. But, unfortunately, neither the Supplier, Worker, nor Inspector already knows how to “Orient a block,” so that’s still a “big problem”—break it down further!

Big Problem Redefined Problem
Orient a block Move a block from X to A
Determine the current orientation of a block
Turn a block around a specific axis

Again, the first and third steps of this operation involve manipulating the block, which is built-in functionality that the Worker can already do. But in order to “Determine the current orientation of a block,” we’ll need to ask a number of carefully chosen questions.

Big Problem Redefined Problem
Determine current orientation Ask 1st Y/N question
...

And since the Inspector already knows how to answer each of these Y/N questions, we can stop here. There’s no need to break this big problem down any further. Instead, we can start constructing a solution.

For example, depending on the particular building criteria, the above analysis and redefinition of each problem into simpler tasks might result in a typical solution similar to the following:

```For each of the N towers...
...For each of the M blocks in a tower...
...SUPPLIER: Supply a block to X
...WORKER: Move a block from X to A
...INSPECTOR: Is the [TOP] face [RED]?
...If INSPECTOR said YES..
...WORKER: Turn the block on the [N/S] axis
...If INSPECTOR said NO..
...WORKER: Turn the block on the [E/W] axis
...WORKER: Move a block from A to [location]
```