Breaking a problem into small pieces
We said an algorithm is "a set order for solving a problem." But facing a big problem, that order just won't come. There's one trick. If it won't go down in one bite, break it into small pieces of the same shape.
It won't go down in one bite
Told to clean a whole room,
you freeze.
Where to even start,
the order won't come.
A big problem is like that.
Seen as one lump,
it's too big to take in one bite.
Tap the big problem lump. It breaks into small pieces. (Clean the room → desk · bed · floor · shelf)
The whole room felt hopeless,
but broken into
desk, bed, floor, shelf,
it suddenly looks doable.
The first step to solving
a big problem is just this:
breaking it small.
The same shape, just smaller
Look closely at a piece
and there's something fun.
A piece is still "cleaning."
Cleaning the room
has just shrunk into
cleaning the desk.
A piece is the same shape
as the original, only smaller.
Tap a piece to peek inside. Inside is the same-shaped, smaller problem too. (Clean the desk is also = cleaning)
Why is that good?
If you have the head to solve
the big problem,
the same head solves the small piece.
No new method to learn.
Same shape,
so just use the method you had,
but smaller.
Put the pieces in order
Breaking isn't the end.
The pieces have an order too.
If stuff is all over the floor
and you sweep the floor first,
it just gets messed up again.
Clearing the desk and bed first,
and sweeping the floor last,
is the right order.
Tap pieces to line them up in the order to handle them. Up top (desk, bed, shelf) first, floor last is right.
With the order set right,
the pieces don't collide.
No more redoing what an
earlier piece messed up
with a later one.
It's just like lesson one.
Even the same pieces,
in a different order, give a different result.
Combine the piece answers
You've solved every piece.
The desk, the bed, the floor,
all clean.
But wait,
you only solved the pieces.
Isn't the room still unfinished?
No.
When the pieces are all done,
their sum is the clean room.
Tap the solved pieces one by one to combine them. When every piece answer is gathered, that is the answer to the big problem (a clean room).
So combining
isn't free.
Gathering the piece answers
and joining them into one
is a real step too.
Break, solve in order, combine.
All three beats have to line up
for the big problem to truly be solved.
In summary: break, order, combine
When a big problem stumps you,
recall these four beats.
First, break it into same-shaped small pieces.
Second, see a piece is the same problem.
Third, set the right order.
Fourth, combine the piece answers.
This is where computational thinking begins.
Tap the four beats in order to recap the core. Break → same shape → order → combine. The way to handle a big problem, on one panel.
Now no big problem
needs to scare you.
If it won't go in one bite,
just break it.
But one thing:
if there are many pieces,
which one to do first,
the order really starts to matter, right?
Next, we'll touch that lining up, sorting.