[Network] fetch failed


Algorithmic Thinking


Programming is all about solving problems, and one of the most important skills for solving problems is algorithmic thinking. In this unit, you will learn what algorithmic thinking is, how to apply it to problem-solving, and how to write algorithms that solve problems.

What Will You Learn

  • Understand the concept of algorithmic thinking

  • Learn how to apply algorithmic thinking to problem-solving

  • Practice writing algorithms using pseudocode and a recipe analogy

  • Understand the importance of computational thinking

Algorithmic Thinking

Algorithmic thinking is the process of breaking down a problem into smaller, more manageable parts, and designing a step-by-step plan to solve it. This process involves identifying the inputs, the outputs, and the steps needed to transform the inputs into the desired outputs.

Algorithms are a story for computers

To understand algorithmic thinking, let's use an analogy. Imagine that you are writing a story for a computer. The computer can only understand specific instructions, so you need to write the story in a way that the computer can understand.

Just like a story, code is a sequence of events that happen in a specific order. Each event builds upon the previous one, and together they tell a story that the computer can understand and execute.

Stories can branch out into different scenarios and realities based on the circumstances of previous events.

Computational Thinking

Algorithmic thinking is part of a broader concept called computational thinking. Computational thinking is the process of breaking down complex problems into smaller, more manageable parts, and designing solutions that can be executed by a computer.

Computational thinking involves thinking in systems, processes, and pipelines. It requires identifying patterns, creating abstractions, and generalizing solutions to solve similar problems more efficiently.

Writing Algorithms

Writing algorithms involves breaking down a problem into smaller, more manageable parts, and designing a step-by-step plan to solve it. Here are some tips for writing algorithms effectively:

  • Identify the inputs and outputs: Identify what data your program will take in as input and what data it will produce as output.

  • Define the steps: Define the steps needed to transform the inputs into the desired outputs. Write out each step in plain language using pseudocode or a recipe analogy.

  • Test and refine: Test your algorithm with a variety of inputs and refine it as needed to ensure it produces the correct outputs.

Here is an example of an algorithm to add two numbers:

        
1
Inputs: Two numbers, A and B
2
3
Output: The sum of A and B
4
5
Step 1: Take in the two numbers, A and B
6
Step 2: Add A and B together
7
Step 3: Store the result in a variable called "sum"
8
Step 4: Return the value of "sum"

Another Example

Imagine we want to write some pseudo-code or "cooking recipie" for making a sandwich. We can break this down into a series of steps.

Write pseudocode for making a peanut butter and jelly sandwich. Define the inputs, outputs and steps