Working With Algorithm and Flowcharts

Slides:



Advertisements
Similar presentations
CS 240 Computer Programming 1
Advertisements

Algorithms An algorithm is a finite sequence of instructions, logic, an explicit step-by-step procedure for solving a problem. Specific algorithms sometimes.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
How Are Algorithms Developed?
COMPUTER PROGRAMMING I Understand Problem Solving Tools to Design Programming Solutions.
Introduction to Flowcharting
Introduction to Flowcharting
PSEUDOCODE & FLOW CHART
Chapter 2 - Problem Solving
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.
Chapter 2 - Problem Solving
Basics of Computer Programming Web Design Section 8-1.
Flow Chart.
 Draft timetable has the same times as this semester: - ◦ Monday 9:00 am to 12:00 noon, 1:00 pm to 3:00 pm. ◦ Tuesday 9:00 am to 12:00 noon, 1:00 pm.
Tutorial #7 Flowcharts (reprise) Program Design. Introduction We mentioned it already, that if we thing of an analyst as being analogous to an architect,
Chapter 2- Visual Basic Schneider
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 3 Planning Your Solution
Flow Charts. Thinking Creatively Flow Charts START END Is A==6? No A = 1 Yes Print A A = A + 1.
The Program Design Phases
Algorithm & Flowchart.
CSC103: Introduction to Computer and Programming
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
CS001 Introduction to Programming Day 5 Sujana Jyothi
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
C++ If….Else Statements and Flowcharts October 10, 2007.
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.
Flowcharts.
BACS 287 Programming Logic 1. BACS 287 Programming Basics There are 3 general approaches to writing programs – Unstructured – Structured – Object-oriented.
ITEC113 Algorithms and Programming Techniques
Top-Down Design Damian Gordon. Top-Down Design Top-Down Design (also known as stepwise design) is breaking down a problem into steps. In Top-down Design.
LO: We’re learning to demonstrate the need for breaking down problems into smaller ones.
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.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
`. Lecture Overview Structure Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Visual Basic Flowcharts October 10, Turn in your vocabulary words before you leave!
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Algorithms and Pseudocode
Learning Objective To be able to… Understand flow chart symbols Complete and correct flow chart algorithms Create a program based on a flow chart.
Flow Charts. Flow charts A flowchart is a schematic (idea of doing something) representation of a process. They are commonly used in Computer Science.
Problem Solving Flowcharts. Flowcharts Introduction  Flowcharts allow us to create a visual representation of a solution to a problem DRAW  With flowcharts,
Program Design & Development EE 201 C7-1 Spring
Algorithms and Flowcharts
Introduction to Flowcharting
FLOWCHARTS Part 1.
Basics of Computer Programming
Understand Problem Solving Tools to Design Programming Solutions
Algorithms An algorithm is a sequence of steps written in the form of English phrases that specific the tasks that are performed while solving the problem.It.
Introduction To Flowcharting
Basics of Computer Programming
Introduction to Algorithm – part 1
Basics of Computer Programming
Introduction to Computer Programming
Basics of Computer Programming
Yenka Portfolio Level for this topic: Student Name : My Levels
Design and Technology Academic Year 2017/2018 Grade 7 First Semester.
Unit# 9: Computer Program Development
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Introduction to Algorithms and Programming
Chapter 2- Visual Basic Schneider
How Are Algorithms Developed?
Programming Fundamentals (750113) Ch1. Problem Solving
Flow Diagrams Start End
Programming Fundamentals (750113) Ch1. Problem Solving
Basic Concepts of Algorithm
Flowcharts Activity One
Presentation transcript:

Working With Algorithm and Flowcharts Understanding their practicality

What is an Algorithm? It is a finite set of rules giving a sequence of operations for solving a specific type of problem. In most common computer applications an algorithmic solution to a problem must be constructed.

Design of an Algorithm The design of an algorithm tends to be difficult when the task is non-trivial. Computers tend to lack the intuition or ‘common sense’ to realise the full procedure. The designer must describe the procedure very precisely for it to function properly Top-down design approach is often used.

How does the top-down method work? First try to break the process into a number of steps, which are smaller and simpler than that for the entire process. The sub-algorithms can themselves be broken down into smaller portions We use flow charts to show how the algorithm will work.

Let’s take a look at an algorithm Image you had to program a robot to make coffee.

A Simple Algorithm : Making Coffee 1 Boil water 2 Put coffee

A Simple Algorithm : Making Coffee Original First Refinement 1 Boil water 2 Put coffee 1.1 fill kettle 1.2 switch kettle on 1.3 wait until boiling 1.4 switch off kettle 2.1 open coffee jar 2.2 Fill spoon with coffee 2.3 tip spoonful into cup 2.4 close coffee jar

A Simple Algorithm : Making Coffee Original First Refinement Second Refinement 1 Boil water 2 Put coffee 1.1 fill kettle 1.2 switch kettle on 1.3 wait until boiling 1.4 switch off kettle 2.1 open coffee jar 2.2 Fill spoon with coffee 2.3 tip spoonful into cup 2.4 close coffee jar 1.1.1 put kettle under tap 1.1.2 turn on tap 1.1.3 wait till kettle is full 1.1.4 turn off tap 2.1.1 take coffee jar from shelf 2.1.2 remove lid 2.4.1 put lid on coffee jar 2.4.2 replace coffee jar on shelf

Selection (Decision Statement) An algorithm which is solely a sequence of steps is extremely inflexible A ‘What if …? Then’ Statement allows for this flexibility. What if the coffee jar is empty? Then get a new jar.

Iteration (Repetition or Loop) Sometimes it is necessary for the computer not just to make a decision, but a continuous action. This processes is called iteration. Example : With the robot making the coffee Continue filling coffee jar until jar is found.

What Is a Flowchart? A diagrammatic representation of a program Building a flowchart is like putting a puzzle together; there are standard pieces The standard action shapes include terminal, process, in/output, decision and junction.

What Are the Basic Symbols? A program should always begin with a start symbol and finish symbol For Pascal it equals the begin and the end Start End

What Are the Basic Symbols? Is mark > 50? yes Whenever a decision must be taken a diamond symbol is used. Can you see the correlation to the if…then…else… statements. no Decision/ Comparison Operation

What Are the Basic Symbols? Used to connect different parts of the program together. Connector

What Are the Basic Symbols? A rectangle represents a process. When a variable must be assigned to a value, a process must be used When clearing the screen, changing colour a rectangle must be used mark := 0 Process to be performed

What Are the Basic Symbols? Input and Output are represented using a parallelogram. In Pascal we are dealing with writeln, write, or readln. Read mark from user Show result to user Input /Output Operation

Let’s Put the Pieces Together! Example You are going to school, how will you get there?

Leave the House

Leave the House Check the Weather

Leave the House Check the Weather Weather Clear?

Leave the House Check the Weather Weather Clear? Yes Walk

Leave the House Check the Weather Weather Clear? Yes Walk Arrive at School

Leave the House Check the Weather No, Rain. Weather Clear? Yes Walk Arrive at School

Leave the House Check the Weather No, Rain. Weather Clear? Put on raincoat Yes Walk Arrive at School

Leave the House Check the Weather No, Rain. Weather Clear? Put on raincoat Yes Walk Ride Bus Arrive at School

Leave the House Check the Weather No, Rain. Weather Clear? Put on raincoat Yes Walk Ride Bus Arrive at School