Algorithms Today we will look at: what the word algorithm means

Slides:



Advertisements
Similar presentations
Slide 1 Today you will: Review knowledge and understanding of systems Understand what a system is and what it consists of Apply this understanding by working.
Advertisements

Unit 7.6 Lesson 2 Goals Identify and use flowchart symbols. Plan a sequence of events and incorporate them into a flowchart. Create a simple flowchart.
Tutorial #6 PseudoCode (reprise)
SDP Languages and Environments. Types of Languages and Environments There are 4 main types of language that you must be able to describe at Higher level.
Programming Fundamentals (750113) Ch1. Problem Solving
Introduction to Algorithm – part one Jennifer Elmer Form 3 Computing.
Adapted from slides by Marie desJardins
CS001 Introduction to Programming Day 5 Sujana Jyothi
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
A PowerPoint about Algorithm’s. What is an algorithm?  a process or set of rules to be followed in calculations or other problem-solving operations,
For this unit, you will develop a new swimming / leisure business. 2. You will need to think of a name & concept for the business. 3. Over the.
A PowerPoint about Algorithm’s. What is an algorithm? A step by step process of instruction.
Slide 1 What makes up an information system? Input Process Output Temperature and rainfall from a variety of places Analyse the information and present.
Program Design BUILDING A HOUSE. Steps to Designing a Program 1. Define the Output 2. Develop the logic to get that output 3. Write the program.
Learn about the system life cycle Plan the outline of your project
Slide 1 Controlling Sequences of Events Traffic lights Event table.
Computer Control Using computers to do tasks. What are Computers used for? ringing your alarm clock. microwaving your breakfast checking for text messages.
Pseudocode Skill Area Materials Prepared by Dhimas Ruswanto, BMm.
Repetition In today’s lesson we will look at: why you would want to repeat things in a program different ways of repeating things creating loops in Just.
Sequences, Modules and Variables David Millard
Comp1004: Programming in Java II Computational Thinking.
Computer Control and Monitoring Today we will look at: What we mean by computer control Examples of computer control Sensors – analogue and digital Sampling.
Algorithms and Flowcharts
Scratch Programming Cards
PROGRAMMING: What’s It All About?
Programming – Algorithms (Flowcharts)
Creating Flowcharts Principles of Engineering
Creating a Flowchart Computer Integrated Manufacturing
Software Development.
Broadcasting (Adding a new level)
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
FLOWCHARTS Part 1.
Teaching design techniques to design efficient solutions to problems
Introduction To Flowcharting
Instructing the computer with algorithms and flowcharts
Creating Flowcharts Principles of Engineering
Yenka Portfolio Level for this topic: Student Name : My Levels
Creating Flowcharts AIM:
Learning to program with Logo
Algorithms Y10 Introduction.
Creating Flowcharts Principles of Engineering
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Comp1202: Building Better Programs
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Introduction to Algorithms
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Repetition In today’s lesson we will look at:
Global Challenge Walking for Water Lesson 2.
Programming Fundamentals (750113) Ch1. Problem Solving
Global Challenge Walking for Water Lesson 2.
Flow Diagrams Start End
Global Challenge Walking for Water Lesson 2.
Flowcharts and Pseudo Code
COMPUTATIONAL THINKING COMPUTATIONAL THINKING IN PROGRAMMING
Programming Fundamentals (750113) Ch1. Problem Solving
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Creating Flowcharts Principles of Engineering
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Flowcharts Activity One
WJEC GCSE Computer Science
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Global Challenge Walking for Water Lesson 2.
Algorithms TASK Outcomes What is an algorithm?
Creating Flowcharts Principles Of Engineering
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Presentation transcript:

Algorithms Today we will look at: what the word algorithm means some example algorithms for simple tasks different ways of writing down algorithms why it’s useful to think about this!

What is an Algorithm? Algorithm is just the name we give to a step-by-step procedure for doing something – like a recipe or a set of instructions. It takes its name from Abū ʿAbdallāh Muḥammad ibn Mūsā al-Khwārizmī, a Persian mathematician who also gave use the words algorism (using place value) and algebra. But don’t panic – it’s easier than algebra! In fact, an algorithm is just words.

Algorithm Example We can create an algorithm for anything. The algorithm for making a cup of tea, for example, might look like this: Fill kettle with water Switch on kettle Put tea in teapot Wait If kettle has boiled pour water into teapot, else go back to step 4 Put milk in cup Pour tea into cup All you need to do is follow the steps in order. Notice that step 5 involves making a decision.

Flowcharts Stop Start Has the kettle boiled? Pour the tea! Put the tea in the teapot Fill the kettle with water Wait Switch on the kettle Put milk in the cups Yes No Algorithms can also be described in the form of a diagram called a flowchart. Different stages have different shaped boxes: a rounded one for the beginning and end a square one for a simple instruction a parallelogram (slanted box) for input and output a diamond for a decision.   The flowchart for making a cup of tea would look like the one on the right:

Planning a Task There isn’t necessarily only one correct algorithm for a particular task... for example, it might not matter if you add the sugar or the milk first when you make the tea. Or you could put the tea in the teapot before you switch on the kettle – it wouldn’t really matter. But... some of the steps might need to be done before others... for example, your tea wouldn’t be very nice if you poured the water into the tea pot before you boiled it, and it probably wouldn’t be a good idea to switch on the kettle before you put the water in. For some tasks – e.g. sorting things - there might be some ways of doing them that is quicker (or more efficient)

Why Are We Doing This? Nearly everything you do requires an algorithm: everyday tasks, such as cooking and cleaning mathematical calculations Internet searches sorting navigation (we have already looked at an algorithm for doing this) The main reason we are thinking about this, though, is because it helps us to... write a computer program

Computer Programming A computer program is a sequence of commands used to control the computer; to tell it what to do. For the program to run efficiently, it needs to be planned carefully. The Golden Rule of programming is "don't rush straight to the computer"; you need to first think about what you are going to do. The first stage in planning a computer program is to break job into small steps and write them out in plain English – i.e. we need an algorithm.

Planning a Program You need to decide on the steps that your program will perform before you start to create it You need to decide how the program will start and end, and also whether anything will need repeating: a fixed number of times until a particular event happens – e.g. until a key is pressed, or for a fixed amount of time while a particular variable has a particular value – e.g. keep asking for a password until a password has been entered forever – e.g. traffic lights Your program might need to make a decision

Example Imagine you were going to write the program to do the National Lottery “lucky dip” – what would it need to do? Pick a whole number from 1 – 49 Check that the number hasn’t been drawn already – if it has, then go back to step 1 Repeat steps 1 and 2 until six different numbers have been drawn Sort the numbers into order