Algorithm & Flowchart.

Slides:



Advertisements
Similar presentations
CS 240 Computer Programming 1
Advertisements

PROBLEM SOLVING TECHNIQUES
Selection Flow Charts If statements. Flow of Control The flow of control is a concept we’ve already encountered. The concept of control relates to the.
Flow Control Analysis & Design Tool: Flowcharts
Prof. B. I. Khodanpur HOD – Dept. of CSE R. V. College of Engineering
UNIT 2. Introduction to Computer Programming
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
ME 142 Engineering Computation I Fundamentals of Procedural Computer Programming.
Getting Ready for the NOCTI test
CS 240 Computer Programming 1
Chapter 1 Pseudocode & Flowcharts
Fundamentals of Algorithms MCS - 2 Lecture # 4
Object is a material thing that can be seen and touched.
INTRODUCTION TO PROGRAMMING
Flow Chart.
Chapter 2- Visual Basic Schneider
Developing logic (Examples on algorithm and flowchart)
Review Algorithm Analysis Problem Solving Space Complexity
ALGORITHMS AND FLOW CHARTS 1 Adapted from the slides Prepared by Department of Preparatory year Prepared by: lec. Ghader Kurdi.
Chapter 1 Pseudocode & Flowcharts
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.
Software Life Cycle What Requirements Gathering, Problem definition
A step-by-step procedure for solving a problem in a finite number of steps.
Flowcharts.
ALGORITHM List of instructions for carrying out some process step by step. A sequence of instructions which has a clear meaning and can performed with.
Chapter 2: General Problem Solving Concepts
Program Planning and Design. What is Program Planning and Design? Program planning and design is simply knowing what you want to do and how you want to.
Basic problem solving CSC 111.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
1 Program Planning and Design Important stages before actual program is written.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
CSC 111. Solving Problems with Computers Java Programming: From Problem Analysis to Program Design, Third Edition3 Solving Problems Stages 1.Problem.
Introduction to Computing Dr. Nadeem A Khan. Lecture 2.
Selection Flow Charts If statements. Flow of Control The flow of control is a concept with which we’re already familiar. The concept of control relates.
LESSON 1 Introduction to Programming Language. Computer  Comprised of various devices that are referred to as HARDWARE.  The computer programs that.
Problem, Problem Solving, Algorithm & Flow Charts –Part 1 Presented By Manesh T Course:101 CS 101CS Manesh T1.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
FLOWCHARTING AND ALGORITHMS
Flowcharts C++ Lab. Algorithm An informal definition of an algorithm is: a step-by-step method for solving a problem or doing a task. Input data A step-by-step.
Flow Charts. Flow charts A flowchart is a schematic (idea of doing something) representation of a process. They are commonly used in Computer Science.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
Program Design & Development EE 201 C7-1 Spring
Pseudocode (pronounced SOO-doh-kohd)  is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled.
ALGORITHMS AND FLOWCHARTS
GC101 Introduction to computers and programs
Lesson 2 Flowcharting.
Chapter One Problem Solving
Chapter 2- Visual Basic Schneider
Computer Programming Flowchart.
Lecture 2 Introduction to Programming
Introduction To Flowcharting
ALGORITHM Basic CONCEPTS of Basic Concepts of Algorithm
Numbering System TODAY AND TOMORROW 11th Edition
Algorithm Algorithm is a step-by-step procedure or formula or set of instruction for solving a problem Its written in English language or natural language.
Unit# 9: Computer Program Development
Chapter 2- Visual Basic Schneider
Chapter 1 Pseudocode & Flowcharts
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
Introduction to Programming
Basic Concepts of Algorithm
Introduction to Programming
Introduction to Flowcharts
Presentation transcript:

Algorithm & Flowchart

An informal definition of an algorithm is: Algorithm: a step-by-step method for solving a problem or doing a task. Figure 8.1 Informal definition of an algorithm used in a computer

Algorithm A step-by-step problem-solving procedure An algorithm is a sequence of unambiguous instructions for solving a problem. The number of steps of an algorithm will be countable and finite. It is a sequence of instructions (or set of instructions) to make a program more readable; a process used to answer a question.

Develop an algorithm/method of solution Understand the problem. Define the problem Analyze the problem Develop an algorithm/method of solution Write a computer program corresponding to the algorithm Test and debug the program Document the program (how it works and how to use it)

There are two commonly used tools to help to document program logic (the algorithm). These are : Flowcharts Pseudo code.

Flowchart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as boxes of various kinds and their order by connecting these with arrows. This diagrammatic representation can give a step-by-step solution to a given problem.

Process operations are represented in these boxes, and arrows connecting them represent flow of control. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields.

Symbols Start and end symbols, represented as lozenges, ovals or rounded rectangles, usually containing the word "Start" or "End", or another phrase signaling the start or end of a process, such as "submit enquiry" or "receive product". Arrows, showing what's called "flow of control" in computer science. An arrow coming from one symbol and ending at another symbol signifies flow passes to the symbol the arrow points to. Processing steps, represented as rectangles. Examples: "Add 1 to X"; "replace identified part"; "save changes" or similar. Input/Output, represented as a parallelogram. Examples: Get X from the user; display X. Conditional (or decision), represented as a diamond (rhombus). These typically contain a Yes/No question or True/False test .

Start or end of the program Computational steps or processing function of a program Input or output operation Decision making and branching Connector or joining of two parts of program

1- Simple sequential Flowchart • Example 1: - Read X, Y, Z Compute Sum (S) as X + Y +Z Compute Average (A) as S / 3 Compute Product (P) as X xYxZ - Write (Display) the Sum,Average and Product

• Example 2: Find the sum of two numbers • Example 2: Find the sum of two numbers. – Variables: • A: First Number • B: Second Number • C: Sum (A+B) – Algorithm: • Step 1 – Start • Step 2 – Input A • Step 3 – Input B • Step 4 – Calculate C = A + B • Step 5 – Output C • Step 6 – Stop

• Example 3: Find the difference and the division of two numbers and display the result

• Example 4: Find the circle area and circumcenter of a circle where R (radius) is given (exercise) – Variables: • R: Radius • A: Area •C: Circumcenter – Algorithm: • Step 1 – Start • Step 2 – Input R • Step 3 – Calculate Pi • Step 4 – Calculate A = Pi(R)2 • Step 5 – Calculate C = 2Pi(R) • Step 6 – Print R, A, C • Step 7– Stop

• Example 1: 2- Branched Flowcharts Draw a flowchart that shows the traffic light processing (exercise) – Algorithm: • Step 1 – Start • Step 2 – make a Decision (what is the color) • Step 3 – if the color is Red then STOP • Step 4 – if the color is Yellow then WAIT • Step 5 – if the color is Green then PASS • Step 6– Stop

3- Loop Flowcharts • Example 1:

• Example 2 Average for 10 numbers