Examples of Flow Charts Pseudocodes

Slides:



Advertisements
Similar presentations
ALGORITHMS AND FLOWCHARTS
Advertisements

ALGORITHMS AND FLOWCHARTS
PROBLEM SOLVING TECHNIQUES
1.4 Programming Tools Flowcharts Pseudocode Hierarchy Chart
PSEUDOCODE & FLOW CHART
Chapter 2 - Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
ALGORITHMS AND FLOWCHARTS
Chapter 2 - Problem Solving
Session Objectives# 24 COULD code the solution for an algorithm
8 Algorithms Foundations of Computer Science ã Cengage Learning.
Chapter 2- Visual Basic Schneider
Chapter 3 - Structured Program Development
©Brooks/Cole, 2003 Chapter 8 Algorithms. ©Brooks/Cole, 2003 The Origins of “Algorithm”
Pseudocode and Algorithms
Unit 171 Algorithms and Problem Solving  Introduction  Algorithm Design  Algorithm Properties  Algorithm Control Flow  Examples  Comparing Algorithms.
Developing logic (Examples on algorithm and flowchart)
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
An ordered sequence of unambiguous and well-defined instructions that performs some task and halts in finite time Let's examine the four parts of this.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
©Brooks/Cole, 2003 Chapter 8 Algorithms. ©Brooks/Cole, 2003 Understand the concept of an algorithm. Define and use the three constructs for developing.
Structured Program Development Outline 2.1Introduction 2.2Algorithms 2.3Pseudo code 2.4Control Structures 2.5The If Selection Structure 2.6The If/Else.
CSE 102 Introduction to Computer Engineering What is an Algorithm?
Chapter 8 Algorithms. Understand the concept of an algorithm. Define and use the three constructs for developing algorithms: sequence, decision, and repetition.
ALGORITHM CHAPTER 8. Chapter Outlines and Objectives  Define an algorithm and relate it to problem solving.  Define three construct and describe their.
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
PSEUDOCODE C Programming Technique – Firdaus-Harun.com.
Coding Design Tools Rachel Gauci. What are Coding Design Tools? IPO charts (Input Process Output) Input- Make a list of what data is required (this generally.
1 The Programming Layer 2 Outline Concepts –Definition –How to develop an algorithm –Essential features Three Constructs Algorithm Representation –Pseudocode.
C Lecture Notes 1 Structured Program Development.
Programming at a high level. Developing a Computer Program Programmer  Writes program in source code (VB or other language) Compiler  Converts source.
ALGORITHMS AND FLOWCHARTS CSCI 105 – Computer Fluency.
Procedural Programming. Programming Process 1.Understand the problem 2.Outline a general solution 3.Decompose the general solution into manageable component.
Lecture 4: C/C++ Control Structures Computer Programming Control Structures Lecture No. 4.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
Introduction to Computing Dr. Nadeem A Khan. Lecture 2.
Chapter 8 Algorithms.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
©Brooks/Cole, 2003 Chapter 8 Algorithms. ©Brooks/Cole, 2003 CONCEPTCONCEPT 8.1.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Think First, Code Second Understand the problem Work out step by step procedure for solving the problem (algorithm) top down design and stepwise refinement.
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
ALGORITHMS AND FLOWCHARTS. A typical programming task can be divided into two phases: Problem solving phase  produce an ordered sequence of steps that.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Lecture 2: Introduction to Programming EEE2108: 공학프로그래밍 서강대학교 전자공학과 2011 학년도 2 학기 - Algorithms and Flowcharts -
Program design Program Design Process has 2 phases:
GC101 Introduction to computers and programs
while Repetition Structure
ALGORITHMS AND FLOWCHARTS
COVERED BASICS ABOUT ALGORITHMS AND FLOWCHARTS
Introduction to Computing
CS111 Computer Programming
Chapter 4: Control Structures
Pseudo Code.
ALGORITHMS AND FLOWCHARTS
Lecture 2: Logical Problems with Choices
ALGORITHMS AND FLOWCHARTS
Algorithms & Pseudocode
Structured Program
Programming in Pseudocode
ALGORITHMS AND FLOWCHARTS
Introduction to Algorithms and Programming
PROBLEM ANALYSIS.
Introduction to Programming
Programming Concepts and Database
EPSII 59:006 Spring 2004.
Teori Bahasa dan Automata Lecture 13: Algorithm
Presentation transcript:

Examples of Flow Charts Pseudocodes Lecture 9 Examples of Flow Charts Pseudocodes

PseudoCode PseudoCode is a mixture of natural language and symbols, terms, and other features of the programmer. It is programmer specific Indentation of key blocks of instructions

Pseudocode for three constructs

Write an algorithm in pseudocode that finds the average of two numbers Example 1 Write an algorithm in pseudocode that finds the average of two numbers

Average of two AverageOfTwo Input: Two numbers Add the two numbers Divide the result by 2 Return the result by step 2 End

Write an algorithm to change a numeric grade to a pass/no pass grade. Example 2 Write an algorithm to change a numeric grade to a pass/no pass grade.

Pass/no pass Grade Pass/NoPassGrade Input: One number if (the number is greater than or equal to 70) then 1.1 Set the grade to “pass” else 1.2 Set the grade to “nopass” End if Return the grade End

Write an algorithm to change a numeric grade to a letter grade. Example 3 Write an algorithm to change a numeric grade to a letter grade.

Letter grade LetterGrade Input: One number 1. if (the number is between 90 and 100, inclusive) then 1.1 Set the grade to “A” End if 2. if (the number is between 80 and 89, inclusive) then 2.1 Set the grade to “B” Continues on the next slide

Letter grade (continued) 3. if (the number is between 70 and 79, inclusive) then 3.1 Set the grade to “C” End if 4. if (the number is between 60 and 69, inclusive) then 4.1 Set the grade to “D” Continues on the next slide

Letter grade (continued) 5. If (the number is less than 60) then 5.1 Set the grade to “F” End if 6. Return the grade End

Example 4 Write an algorithm to find the largest of a set of numbers. You do not know the number of numbers.

Find largest FindLargest Input: A list of positive integers Set Largest to 0 while (more integers) 2.1 if (the integer is greater than Largest) then 2.1.1 Set largest to the value of the integer End if End while Return Largest End

Write an algorithm to find the largest of 1000 numbers. Example 5 Write an algorithm to find the largest of 1000 numbers.

Find largest of 1000 numbers Input: 1000 positive integers Set Largest to 0 Set Counter to 0 while (Counter less than 1000) 3.1 if (the integer is greater than Largest) then 3.1.1 Set Largest to the value of the integer End if 3.2 Increment Counter End while Return Largest End