Presentation is loading. Please wait.

Presentation is loading. Please wait.

ALGORITHMS & FLOWCHART BASIC INTRODUCTORY COURSE

Similar presentations


Presentation on theme: "ALGORITHMS & FLOWCHART BASIC INTRODUCTORY COURSE"— Presentation transcript:

1 ALGORITHMS & FLOWCHART BASIC INTRODUCTORY COURSE

2 A PROCEDURE AN ALGORITHM
A procedure is a finite sequence of well-defined instructions A PROCEDURE An algorithm is a step-by-step procedure to solve a given problem AN ALGORITHM

3 ALGORITHMS EXAMPLES OF An algorithm for preparing breakfast
An algorithm for drawing a curve An algorithm for baking cake An algorithm for preparing rice and stew

4 : IN REAL LIFE ALGORITHM Problem Solution Baking a Cake Start
Preheat oven at 180℃ Prepare a baking pan Beat butter with sugar Mix them with flour, eggs and essence vanilla Pour the dough into a baking pan Put the pan into the oven End

5 ALGORITHMS? WHY DO WE BUILD
If we wish to build a house, we need to design it first. Can you think of some possible consequences of not designing a house before building it? Similarly, computer programs (especially large and complex ones) need to be designed before they are written. Can you think of some possible consequences of not designing a program before building it? One of the things considered when designing a computer program is the algorithm which it will be based on.

6 ALGORITHMS IN PROGRAM DESIGN
A computer program is built to solve a certain problem. Examples: A program to calculate the grades obtained in a given class A program to produce a document 3. A program to view an image

7 TO BUILD A PROGRAM TO SOLVE A PROBLEM?
ALGORITHM Analyze the problem Design a computer solution to the problem by developing an algorithm. Write a computer program based on the algorithm. Test the program.

8 ALGORITHM HOW TO SPECIFY AN TEXTUALLY GRAPHICALLY
For example, using pseudo code (see later) TEXTUALLY For example, using flowcharts or UML activity charts GRAPHICALLY

9 FLOWCHARTS A flowchart is a graphical representation of the sequence of operations in a program. An algorithm can be represented graphically using a flowchart. A flowchart is a graphical representation of an algorithm.

10 NOTATION FLOWCHARTS SYMBOL SEMANTIC Start/End Process Input/Output
Test Connector Flow of activities

11 FLOWCHART : EXAMPLE 1 Algorithm starts here Input data from user
Gregorian date Input data from user Convert Gregorian date to Islamic date Perform date conversion Display Islamic date Display the results End Algorithm ends here

12 PSEUDOCODE An outline of a program, written in a form that can easily be converted into real programming statements. It resembles the actual program that will be implemented later. However, it cannot be compiled nor executed.

13 PSEUDOCODE Pseudocode normally codes the following actions:
Initialization of variables Assignment of values to the variables Arithmetic operations Relational operations

14 EXAMPLES PSEUDOCODE Start Read quantity. Read price_per_kg
price = quantity * price_per_kg Print price End

15 FLOWCHART : EXAMPLE 2 Start length, width and area are referred to as variables. A variable is like a box in which a value can be stored Input length,width area length x width Output area End

16

17

18 ASSIGNMENT Write a simple algorithm for withdrawing a sum of money at an ATM. Draw a flowchart which represents the algorithm built in above.

19 KNOW YOU SHOULD NOW What an algorithm is
When an algorithm should be developed when building a computer program The basic steps in building a computer program to solve a problem What flowcharts are How to represent algorithms graphically using flowcharts

20 YOU! THANK END OF SESSION COMPUTER SCIENCE AFRICA


Download ppt "ALGORITHMS & FLOWCHART BASIC INTRODUCTORY COURSE"

Similar presentations


Ads by Google