video

Lesson video

In progress...

Loading...

Hello and welcome to Computing.

My name is Mrs. Holborow.

I'm so pleased you've been able to join me for the lesson today.

Today, we are going to be investigating algorithms and computer programmes and comparing the differences between them.

Welcome to today's lesson from the unit Algorithms. This lesson is called Comparing Algorithms to Computer Programmes, and by the end of today's lesson, you'll be able to describe the differences between algorithms and computer programmes.

Shall we make a start? We will be exploring these keywords throughout today's lesson.

Algorithm.

Algorithm, a set of step-by-step instructions to solve a problem.

Computer programme.

Computer programme, a way to implement an algorithm by writing it in a language that a computer can use.

Logic.

Logic, a system of rules that determine the flow of instructions.

We'll be revisiting these keywords throughout today's lesson.

Today's lesson is broken down into two sections.

We'll start by defining algorithms and computer programmes and then we'll move on to compare algorithms and computer programmes.

Let's make a start by defining algorithms and computer programmes.

Look at the images below.

Which image best represents the plan of making a meal? Is it A or B? Pause the video whilst you have a quick think.

That's right.

A best represents the plan of making a meal.

An algorithm is a set of step-by-step instructions that are followed to solve a problem.

A recipe is an example of an algorithm because it outlines the step-by-step instructions needed to make a meal.

An algorithm is a logical plan that can be used to solve specific problems. People use algorithms every day without realising it, such as brushing their teeth, making a meal, making a drink, or getting ready for school.

To complete each of these tasks, a series of specific step-by-step instructions must be followed in a logical order.

A chef follows a recipe to create a meal.

The chef follows the step-by-step instructions from the recipe algorithm to make the meal.

An algorithm can be designed to solve the problem of making tomato soup.

Tomato soup could be made in many different ways.

Look at the example algorithm to solve this problem.

Gently cook the onions and garlic until soft.

Add tomatoes, vegetable stock, dried basil, salt and pepper.

Cover and simmer the ingredients for 30 minutes.

Use a blender to blend the soup until smooth.

Serve the soup in bowls using a ladle and add a garnish.

An algorithm can be repeated as many times as necessary to solve the same problem in the same way.

Taking the example of our tomato soup recipe, we could make the soup again and again following the same steps in the recipe or algorithm.

Time to check your understanding.

The instruction booklet used to help assemble flat pack furniture is an example of A, a computer programme, B, an algorithm, or C, abstraction? Pause the video whilst you have a think.

That's right.

The instruction booklet is an example of an algorithm.

Well done.

True or false? An algorithm can be reused to solve the same problem as many times as necessary.

Pause the video whilst you have think.

That's right.

It's true.

An algorithm can be reused many times.

Computers use algorithms to solve problems. For a computer to follow an algorithm, the instructions must be converted into a computer programme.

A computer programme is a way to implement an algorithm.

A computer programme must be written in a programming language the computer can interpret, so it can execute the instructions and logic of the algorithm.

Aisha has a question, "What programming language do I need to use to implement an algorithm?" Do you have an answer for Aisha? Maybe pause the video and have a think.

Ah, Lucas has an answer.

"Maybe an algorithm can be implemented in lots of different programming languages?" Well done, Lucas.

You're right.

Algorithms can be implemented in many different languages.

The ideal programming language depends on several factors such as the performance and project requirements.

True or false? A computer programme is a way to implement an algorithm and can be written in many programming languages.

Pause the video whilst you have a think.

That's right.

This statement is true.

A computer programme is used to implement an algorithm.

Okay, we are now moving on to the first task of today's lesson, and you've done a fantastic job so fast, so well done.

Aisha and Izzy here are discussing algorithms and computer programmes.

Izzy says, "I'm still struggling to understand algorithms and computer programmes.

Can you describe them to me again please, Aisha?" For Part 1, write a simple description to help Izzy understand algorithms. For Part 2, write a simple description to help Izzy understand a computer programme.

Pause the video whilst you complete the activity.

How did you get on? Great work.

Aisha has a sample answer here.

So for Part 1, you were asked to write a simple description to help Izzy understand algorithms. An algorithm is like a set of instructions that can be followed to logically solve a problem, like a step-by-step recipe or building instructions.

Both humans and computers can use algorithms. Izzy says, "Oh, I think that makes sense, but what about a computer programme?" For Part 2, you're asked to write a simple description to help Izzy understand a computer programme.

Aisha's got another sample answer here.

"A computer programme is a specific set of instructions that a computer can use to execute the logic of an algorithm.

A computer programme can be written in a language like Python or Java." Great response Aisha, well done.

Izzy says, "I think I get now.

Thank you, Aisha!" Okay, we're now moving on to the second part of today's lesson and you're doing a great job so far, so well done.

We are now going to compare algorithms and computer programmes.

Sam is thinking about the difference between algorithms and computer programmes.

Sam says, "I think an algorithm provides a more general idea of how to solve a problem than a computer programme." Do you agree with Sam? Maybe pause the video and have a think.

Sam is correct.

An algorithm is a general set of instructions that can be translated into different programming languages.

The terms algorithms and computer programmes can often overlap but are in fact distinct from one another.

What do you think the difference is between an algorithm and a computer programme? An algorithm describes the logic of a solution.

A computer programme is a specific way of implementing the solution written in a programming language.

In computer science, algorithms can be represented in a number of ways, such as written descriptions, flow charts, or pseudocode.

In a written description of an algorithm, the logic is expressed in a readable human language.

For example, one, ask the user their name.

Two, take the name from the user and store it in a variable.

Three, welcome the user using their name.

This is all language that we understand and can read as humans.

In a flow chart, the logic and flow of an algorithm is expressed visually using arrows and shapes.

So we have the start symbol at the top and then we output What is your name.

We then take input of the username and then we output the welcome message and then we end the flow chart.

In pseudocode, an algorithm is expressed using syntax that is independent of any particular programming language.

So here's some example of some pseudocode.

Print, What is your name, in brackets, name is equal to input, and then print, Hello, plus name.

Time to check your understanding.

Which expression of an algorithm uses shapes and arrows to outline the flow and logic? Is it A, a flow chart, B, a written description, or C, pseudocode? Pause the video whilst you have a think.

Did you select A? Well Done.

A flow chart represents an algorithm using shapes and arrows to outline the flow and logic.

A computer programme is designed to be executed by a computer using a certain programming language.

A computer programme programme is therefore a specific set of programmed instructions that implement the logic of an algorithm.

Programmers create computer programmes that implement algorithms using many different languages such as Python, C#, or Java.

A programmer will choose whichever language is most suited to the application.

Computer programmes may look very different to each other even though they implement the same logic of an algorithm.

This is because programming languages have syntax rules that must be followed for the computer to execute the instructions correctly.

Consider the following simple algorithm expressed in pseudocode.

So print, What is your name? Name equals input, and then print, Hello, plus name.

So this pseudocode that we've already seen so far this lesson.

The computer programme that implements this algorithm will look different for each programming language.

A computer programme that implements the algorithm in the Python programming language may look like this.

So it's quite similar to our pseudocode, but there are some differences.

Notice lack of capital letters, for example.

print, in lowercase, open brackets, speech marks, What is your name, close speech marks, close bracket, name is equal to input, open, close bracket, and then we have print, and then we are using an f-string here.

So we've got f Hello, and then we've got the variable name in part of the print statement.

A computer programme that implements the algorithm in C# programming language may look like this.

So it looks quite different.

So we've got Console.

WriteLine, and then we have What is your name in brackets and speech marks again, but then we have a semicolon at the end of the line, and then we have string name = Console.

ReadLine, and then we have Console.

WriteLine, and then we have a dollar sign this time with Hello name in speech marks.

A computer programme that implements the algorithm in the Java programming language may look like this.

So it's different again.

We've got System.

out.

println, which stands for print line.

What is your name.

Again, we've got a colon at the end, and then we have String name = scanner.

nextLine.

And then we have System.

out.

println, Hello plus name, this time.

So no curly brackets.

True or false? A computer programme is a general outline of the steps needed to solve a problem.

Is this true or false? pause the video whilst you have a think.

That's right, it's false.

A computer programme is a specific set of programme instructions that a computer can use to implement the logic of an algorithm.

Izzy says, "So an algorithm expresses the logical solution and a computer programme implements the logic in a programming language for a computer to execute?" Aisha says, "That's right, Izzy, you've got it!" Well done, Izzy.

Okay, we are now coming to the last set of tasks for today's lesson, Task B.

You're doing a great job so far, so well done.

Modern vending machines are usually controlled by computer systems. A vending machine is designed to take an order from a user and dispense the order once payment has been made.

For Part 1, write a paragraph to describe some of the differences and similarities between the algorithm and computer programme of a vending machine.

Note, you do not need to write or know about the specific algorithm or computer programme in this question.

Just try to show your understanding of the ideas of algorithms and computer programmes.

Pause the video whilst you complete the task.

How did you get on? Great work.

Here's a sample answer.

An algorithm for a vending machine is a set of step-by-step instructions that explains how to solve the problem of taking and dispensing orders.

It's a plan that shows the logic behind how the vending machine should work.

A programmer takes this algorithm and turns it into a computer programme, code written in a programming language like Python so that the machine can follow the instructions.

The logic of the algorithm stays the same, even if it's written in a different programming language.

Both the algorithm and the programme aim to achieve the same goal, but the algorithm is more like a plan while the programme is something the computer can actually run.

Hopefully you've got something similar to this.

If you need to add any detail to your answer, remember, you can always pause the video here and make some additional notes.

Okay, we've come to the end of today's lesson and you've done a fantastic job, so well done.

Let's summarise what we've learned together.

An algorithm is a series of defined logical steps that are followed to solve a problem.

A computer programme is a way of implementing an algorithm by writing it in a language that a computer can understand.

An algorithm can be implemented in many different computer programmes.

I hope you enjoyed today's lesson, and I hope to see you again soon.

Bye.