Algorithms Introduction
Algorithms are at the heart of computational thinking. Once you have broken down a problem, identified patterns, and created abstractions, you are ready to put those back together into an algorithm. An algorithm is a set procedure that, given a known input, will produce a predictable output. In Elementary Education, the example I most often hear is that an algorithm is like a recipe:
The modern world is replete with known algorithms that you use but may not even be aware of. For example, have you ever clicked on a list on your computer to order it from A-Z, Z-A or by increasing value? Can you think of the algorithm that you might use to make this sort work? Computer scientists have actually discovered dozens of different sorting algorithms, all of which have their pros and cons. Here's a 2-minute YouTube video that one coder created to show 24 different sorting algorithms: Visualization of 24 Sorting Algorithms In 2 Minutes
Links to an external site.
Perhaps it's more fun to watch the sorting happen as a dance. There's a Romanian group that has created a series of videos showing different sorting algorithms in action, like this video of a quick sort:
Quick-sort with Hungarian (Küküllőmenti legényes) folk dance
Links to an external site.
But probably, you're more interested in simpler, more personalized algorithms. For example, do you have an algorithm for classroom procedures? What about the "clean up" procedure? It might go something like this:
- Stop what you are working on;
- Listen to the teacher;
- Show that you're listening by looking at the teacher and putting down whatever is in your hands;
- Once the teacher has finished telling you what to clean up, put each item in its pre-chosen storage location;
- Repeat step 4 until there are no more items at your desk to put away;
- Return to desk and sit quietly until the teacher calls on you.
You probably already realized that Scratch (and all coding programs) has built-in algorithms. These are often called "functions" or "methods." In Scratch, they're often called "blocks." Did you know that there's a way of creating your own block-based algorithms in Scratch? Advance to the next page to practice creating your own algorithmic blocks in Scratch.