Αρχική » 2020 » Μάρτιος

Αρχείο μηνός Μάρτιος 2020

LTTA 1 Meeting Agenda Rhodes, 27-31 JAN 2020

C1. Meeting Agenda Rhodes, 27-31 JAN 2020

BBC Representing an algorithm: Pseudocode and flowcharts

There are two main ways that algorithms can be represented – pseudocode and flowcharts.

Representing an algorithm: Pseudocode

Most programs are developed using programming languages. These languages have specific syntax that must be used so that the program will run properly. Pseudocode is not a programming language, it is a simple way of describing a set of instructions that does not have to use specific syntax.

Writing in pseudocode is similar to writing in a programming language. Each step of the algorithm is written on a line of its own in sequence. Usually, instructions are written in uppercase, variables in lowercase and messages in sentence case.

In pseudocode, INPUT asks a question. OUTPUT prints a message on screen.

A simple program could be created to ask someone their name and age, and to make a comment based on these. This program represented in pseudocode would look like this:

OUTPUT 'What is your name?'
INPUT user inputs their name
STORE the user's input in the name variable
OUTPUT 'Hello' + name
OUTPUT 'How old are you?'
INPUT user inputs their age
STORE the user's input in the age variable
IF age >= 70 THEN
OUTPUT 'You are aged to perfection!'
ELSE
OUTPUT 'You are a spring chicken!'

In programming, > means ‘greater than’, < means ‘less than’, ≥ means ‘greater than or equal to’ and ≤ means ‘less than or equal to’.

Representing an algorithm: Flowcharts

A flowchart is a diagram that represents a set of instructions. Flowcharts normally use standard symbols to represent the different instructions. There are few real rules about the level of detail needed in a flowchart. Sometimes flowcharts are broken down into many steps to provide a lot of detail about exactly what is happening. Sometimes they are simplified so that a number of steps occur in just one step.

Flowchart symbols

bbc flowchart

A simple program could be created to ask someone their name and age, and to make a comment based on these. This program represented as a flowchart would look like this:

bbc algo 2

BBC Algorithms

An algorithm is a plan, a set of step-by-step instructions to resolve a problem. In an algorithm, each instruction is identified and the order in which they should be carried out is planned.

What is an algorithm?

Algorithms are one of the four cornerstones of Computer Science. An algorithm is a plan, a set of step-by-step instructions to solve a problem. If you can tie shoelaces, make a cup of tea, get dressed or prepare a meal then you already know how to follow an algorithm.

In an algorithm, each instruction is identified and the order in which they should be carried out is planned. Algorithms are often used as a starting point for creating a computer program, and they are sometimes written as a flowchart or in pseudocode.
If we want to tell a computer to do something, we have to write a computer program that will tell the computer, step-by-step, exactly what we want it to do and how we want it to do it. This step-by-step program will need planning, and to do this we use an algorithm.
Computers are only as good as the algorithms they are given. If you give a computer a poor algorithm, you will get a poor result – hence the phrase: ‘Garbage in, garbage out.’Algorithms are used for many different things including calculations, data processing and automation.

bbc algo

Making a plan

It is important to plan out the solution to a problem to make sure that it will be correct. Using computational thinking and decomposition we can break down the problem into smaller parts and then we can plan out how they fit back together in a suitable order to solve the problem.

This order can be represented as an algorithm. An algorithm must be clear. It must have a starting point, a finishing point and a set of clear instructions in between.

More resources on algorithms by Barefoot 

BBC Abstraction test

Visit BBC site to take Abstraction test

More tests on Computational Thinking by BBC 

BBC Abstraction in practice

How to abstract

Abstraction is the gathering of the general characteristics we need and the filtering out of the details and characteristics that we do not need.

When baking a cake, there are some general characteristics between cakes. For example:

  • a cake needs ingredients
  • each ingredient needs a specified quantity
  • a cake needs timings

When abstracting, we remove specific details and keep the general relevant patterns.

General patterns Specific details
We need to know that a cake has ingredients We don’t need to know what those ingredients are
We need to know that each ingredient has a specified quantity We don’t need to know what that quantity is
We need to know that each cake needs a specified time to bake We don’t need to know how long the time is

Creating a model

A model is a general idea of the problem we are trying to solve.

For example, a model cat would be any cat. Not a specific cat with a long tail and short fur – the model represents all cats. From our model of cats, we can learn what any cat looks like, using the patterns all cats share.

Similarly, when baking a cake, a model cake wouldn’t be a specific cake, like a sponge cake or a fruit cake. Instead, the model would represent all cakes. From this model we can learn how to bake any cake, using the patterns that apply to all cakes.

Once we have a model of our problem, we can then design an algorithm to solve it.

BBC Abstraction

What is abstraction?

Abstraction is one of the four cornerstones of Computer Science. It involves filtering out – essentially, ignoring – the characteristics that we don’t need in order to concentrate on those that we do.

In computational thinking, when we decompose problems, we then look for patterns among and within the smaller problems that make up the complex problem.
Abstraction is the process of filtering out – ignoring – the characteristics of patterns that we don’t need in order to concentrate on those that we do. It is also the filtering out of specific details. From this we create a representation (idea) of what we are trying to solve.

What are specific details or characteristics?

In pattern recognition we looked at the problem of having to draw a series of cats.

We noted that all cats have general characteristics, which are common to all cats, eg eyes, a tail, fur, a liking for fish and the ability to make meowing sounds. In addition, each cat has specific characteristics, such as black fur, a long tail, green eyes, a love of salmon, and a loud meow. These details are known as specifics.

In order to draw a basic cat, we do need to know that it has a tail, fur and eyes. These characteristics are relevant. We don’t need to know what sound a cat makes or that it likes fish. These characteristics are irrelevant and can be filtered out. We do need to know that a cat has a tail, fur and eyes, but we don’t need to know what size and colour these are. These specifics can be filtered out.

From the general characteristics we have (tail, fur, eyes) we can build a basic idea of a cat, ie what a cat basically looks like. Once we know what a cat looks like we can describe how to draw a basic cat.

bbc cat stamp 2

Why is abstraction important?

Abstraction allows us to create a general idea of what the problem is and how to solve it. The process instructs us to remove all specific detail, and any patterns that will not help us solve our problem. This helps us form our idea of the problem. This idea is known as a ‘model’.

If we don’t abstract we may end up with the wrong solution to the problem we are trying to solve. With our cat example, if we didn’t abstract we might think that all cats have long tails and short fur. Having abstracted, we know that although cats have tails and fur, not all tails are long and not all fur is short. In this case, abstraction has helped us to form a clearer model of a cat.

More resources on abstraction by BBC 

LTTA 1 in Rodos Greece 27 to 31 January 2020

The first LTTA for the project was held in Rodos Greece

photo4photo12

Read more information here εδώ

Αλλαγή μεγέθους γραμματοσειράς
Αντίθεση