algorithms part 2

Upload: acebeybe

Post on 03-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Algorithms part 2

    1/13

    Algorithms

    Y10 Introduction

  • 7/27/2019 Algorithms part 2

    2/13

    WHAT IS AN ALGORITHM?

    It is a set of instructions of how to carry out

    a process. An algorithm lists the steps

    that must be followed to complete the

    process and to reach the solution

  • 7/27/2019 Algorithms part 2

    3/13

    Examples of algorithms:

    A knitting pattern

    A set of instructions telling you how to put

    a kit together (eg. an IKEA kitchen unit)

    A recipe in a cook book

    An algorithm can be representeddiagrammatically in the form of a flow

    chart.

  • 7/27/2019 Algorithms part 2

    4/13

    A flow chart

    A flowchart consists of a sequence ofinstructions linked together by arrows toshow the order in which the instructionsmust be carried out.

    It provides detailed steps.

    Each instruction is put into a box. The boxes aredifferent shapes depending upon what theinstruction is.

  • 7/27/2019 Algorithms part 2

    5/13

    Process shapes

    START / END

    Human processi.e. you doing

    something!

    Input or output

    Query / question

    Printed output Save to file

    Yes

    No

    Remember not to create the flowchart in WORD

    Instead do this in POWER POINTand change

    FilePage Layout to PORTRAIT

    Autoshapes has the shapes you

    need to use

  • 7/27/2019 Algorithms part 2

    6/13

    More shapes

    You can also use the following shapes:

    Predefined process

    Used for a sequence of instructions which is defined somewhere

    else (eg. in a subroutine)

    Connector

    to link with a different page or another part of the program

    (Note: all these shapes can be found under AutoShapes

    if you click the Drawing icon on your tool bar)

    Predefined

    process

  • 7/27/2019 Algorithms part 2

    7/13

    TASK 1

    MAKING A CUP OF TEA!

    The following list

    represents the steps

    needed in order to make

    a cup of tea. Put the list in

    the right order andproduce an algorithm in

    POWERPOINTshowing

    the processes and

    decisions you need tomake.

    1. Take tea bag out of cup

    2. Boil the water

    3. Put tea bag in cup

    4. Add milk?

    5. Pour boiling water incup

    6. Fill kettle

    7. Stir

    8. Ready

    9. Add sugar ?

    10. Fetch cupAnswers follow

  • 7/27/2019 Algorithms part 2

    8/13

    The answers1. Fill kettle

    2. Boil the water

    3. Fetch cup

    4. Put tea bag in cup

    5. Pour boiling water in cup

    6. Take tea bag out of cup

    7. Add sugar ?

    8. Stir

    9. Add milk?

    10. Stir

    11. Ready

    START

    Fill kettle

    Boil the water

    Fetch cup

    Put tea bag in cup

    Pour boiling water in cup

    Take tea bag out of cup

    Add sugar ?

    Stir in sugar

    Add milk?

    Pour in milk Ready

    N

    N

    Now add the shapes

  • 7/27/2019 Algorithms part 2

    9/13

    Skills in Powerpoint to create your

    algorithm.

    To tidy up the whole column

    select all (drag around all shapes)

    Go to DRAW

    Select ALIGN or DISTRIBUTE

    To change

    this to .

  • 7/27/2019 Algorithms part 2

    10/13

    START

    Fill kettle

    Boil the water

    Fetch cup

    Put tea bag in cup

    Pour boiling water in cup

    Take tea bag out of cup

    Add sugar ?

    Stir in sugar

    Add milk?

    Pour in milkReady

    N

    N

    To this

    but take care as it can

    mess up the side sections!

  • 7/27/2019 Algorithms part 2

    11/13

    TASK 2

    A PREDEFINED PROCESS

    In order to carry out no. 8 in the list above,

    you will need to instruct the user how to filla kettle.

    (a) Produce a set of instructions called

    Filling a kettle and then(b) update your algorithm for task 1 to

    include this predefined process.

  • 7/27/2019 Algorithms part 2

    12/13

    TASK 3

    MAKING A CUP OF COFFEE!

    How would your algorithm change for

    making a cup of coffee instead of tea?

    Amend your algorithm in Task 2 (b) in

    order to produce a new diagram.

  • 7/27/2019 Algorithms part 2

    13/13

    Now try to create one on a PC

    This should always be done in

    POWERPOINT..

    NEVER, EVER, EVER in WORD!