Now that we know a little bit about Computational Thinking, let's take a look at four elements, or four problem-solving strategies, that we can use in "thinking computationally" about a problem, analyzing the problem and coming up with a solution.
There are a number of different ways of considering Computational Thinking. One useful strategy is to approach a problem with these four aspects in mind.
Even if you've never used this particular vocabulary when problem-solving, most of us have occasion to use some of these strategies on a fairly regular basis. By formally recognizing these steps and identifying their use, we put ourselves in a better position to understand Computational Thinking processes.
Let's get on to some real problem solving!
Take a moment to watch the 5-minute video presentation here. Be sure to pause the video so that you can consider the questions being asked before going on to see the answer.
Take a moment to watch the 5-minute video presentation here. Be sure to pause the video so that you can consider the questions being asked before going on to see the answer.
Shopping for a list of groceries at the supermarket is a common task, and it can occupy a lot of time. What's the best way to go about shopping for groceries?
Consider the problem in terms of our Computational Thinking steps before looking at the solutions below.
Here's one Computational Thinking Analysis:
1. Problem Decomposition
There is a list of items, and those items are located in different parts of the grocery store.
2. Pattern Recognition
I have a random list of items to buy that aren't in any particular order. Items at the store do seem to be organized somewhat: dairy items are all in one area, cheeses are in another, and fruits and vegetables are in their own section. But those sections aren't located in consistent locations from store to store.
3. Abstraction/Model
There isn't much abstraction necessary for this analysis. The grocery list of items can be considered as a List or Array, a data structure that is used all the time in programming. The map of the store is simply an arrangement of locations that need to be visited.
4. Algorithm Design
There are two possible strategies that we might develop for doing our grocery shopping:
Which of these strategies is more efficient? Does the strategy that you choose depend on the length of the shopping list? The size of the store? The number of people you have helping you shop?
Searching algorithms don't just apply to things like buying groceries.
This graphic shows some of the different search strategies that might be employed when looking for an avalanche victim.
It's interesting that the Single Searcher pattern in this graphic looks just like my shopping strategy when I have a long list of items. Fortunately, the results of my shopping—finding where they keep the peanut butter—are a lot less critical then the results for rescue personnel.
Which type of music is more violent: rap or metal? This is a loaded question, purposefully vague, that we're going to try to solve with a computational thinking approach.
This is a good time to point out that the 1-2-3-4 steps that we've been following might not always be addressed in that order. For instance, in this example, we might being by thinking about our abstraction of the problem first.
3. Abstraction/Model
What does it mean to say that "music is violent?" The question itself is open to some interpretation. Is it the music itself that the questioner thinks might be violent? Is it the lyrics that are violent? The images evoked by the lyrics? Are the artists violent? How does one measure "violence?" For the purposes of this exploration, let's say that we're going to consider the lyrics of the music as a measure of the music's violence. The more violent lyrics there are, the more violent we'll consider the music.
1. Problem Decomposition
In our consideration of how we're going to measure violent music, we've decided to look at the lyrics in a song, or—because we're looking at an entire genre of music—a collection of songs. So all we really need to do is get the lyrics from, say, twenty songs in each genre, and look at the lyrics of those songs.
4. Algorithm Design
We'll get the top twenty songs in each genre of music, and get the lyrics for those songs, and then identify words that are associated with violence: death, war, kill, shoot, gun, etc. We'll count how many times each of those words appear in the songs of each genre, and then come up with an average value per song. The highest average of violent words will be the more violent music.
2. Pattern Recognition
Again, we're a little out of order here because in this case, we'll probably want to look at our results and see if we're getting good information. Are we missing some important "violent words" that we didn't think of when we made our original list? Maybe we should add those to our list and re-run our investigation. Are there violent acts that are described in the music that are not getting picked up by our "violent word" filter? Should we consider adding "curse words" to our analysis? Do those kinds of words indicate some degree of aggression or violence? We'll need to figure out a way to account for these things, or at least acknowledge that our algorithm isn't picking up everything.
In any event we know that our measurement won't be perfect. That shouldn't keep us from doing the analysis, we just need to be honest about reporting our methodology so that other people can see how we arrived at our results.
No results are presented here! Are you disappointed?! ;)
This is the kind of problem that you can easily solve yourself. If you want to analyze lots of songs, or lots of genres, you would almost certainly want to use a computer to assist in that analysis. In fact, some people have done that very thing, to examine patterns in the lyrics of certain types of songs.
In this second lesson we've continued to develop the concept of Computational Thinking, and developed four tenets of CT problem-solving that we can use to help solve specific problems.
Those steps include (not necessarily in this order):
Next time, we'll be examining more closely how we can uses Models and Simulations to assist us in developing solutions to problems.
To complete this lesson: