CHAPTER 4: ALGORITHM 4.1 Introduction stages identified in the program development process: 1. Problem analysis and specification 2. Data organization.

Slides:



Advertisements
Similar presentations
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Advertisements

Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
CS 240 Computer Programming 1
Chapter 1 Pseudocode & Flowcharts
C How to Program, 6/e Summary © by Pearson Education, Inc. All Rights Reserved.
Al-Karma Language School Computer Department Prep. 3.
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
Chapter 2: Developing a Program Extended and Concise Prelude to Programming Concepts and Design Copyright © 2003 Scott/Jones, Inc.. All rights reserved.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 3 Planning Your Solution
Problem Solving Chapter 2. What is an algorithm? n A solution to a problem that is: –Precise –Effective –Terminating.
Chapter 2: Algorithm Discovery and Design
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
PRE-PROGRAMMING PHASE
ALGORITHMS AND FLOW CHARTS 1 Adapted from the slides Prepared by Department of Preparatory year Prepared by: lec. Ghader Kurdi.
Fundamentals of C programming
Chapter 1 Pseudocode & Flowcharts
DCT 1123 Problem Solving & Algorithms
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
CIS Computer Programming Logic
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Structural Program Development: If, If-Else Outline.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
CSE 102 Introduction to Computer Engineering What is an Algorithm?
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Software Life Cycle What Requirements Gathering, Problem definition
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
Flowcharts.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Chapter 2: General Problem Solving Concepts
Definition of Terms Software/Programs Programs that directs the operation of a computer system Set of instructions Codes Programming Process of planning,
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Basic problem solving CSC 111.
Chapter 1 Pseudocode & Flowcharts
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.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Program Development C# Programming January 30, 2007 Professor J. Sciame.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
CS2301:Computer Programming 2
CSC 111. Solving Problems with Computers Java Programming: From Problem Analysis to Program Design, Third Edition3 Solving Problems Stages 1.Problem.
Introducing block scheme programming March 17. Algorithm / Flow chart An algorithm or a flowchart is a step-by-step procedure for solving a particular.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
The Hashemite University Computer Engineering Department
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Program design Program Design Process has 2 phases:
Chapter One Problem Solving
Algorithm & Programming
Computer Programming Flowchart.
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Introduction to Algorithm – part 1
Programming Logic n Techniques
Programming Fundamentals
An Introduction to Visual Basic .NET and Program Design
Chapter 1 Pseudocode & Flowcharts
Computers & Programming Languages
Chapter 1 Pseudocode & Flowcharts
Introduction to Algorithms and Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
ICT Gaming Lesson 2.
Chapter 1 Pseudocode & Flowcharts
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Structural Program Development: If, If-Else
Presentation transcript:

CHAPTER 4: ALGORITHM 4.1 Introduction stages identified in the program development process: 1. Problem analysis and specification 2. Data organization and algorithm design A plan with two parts to solve a problem: I. Determine how to organize and store the data. II. Develop procedures to process data and produce output. These procedures are called algorithms 3. Program coding The process of implementing data objects and algorithms in some programming language 4.Execution and testing Check that the algorithm and program are correct. 5. Program maintenance

4.2 Algorithm A sequence of logical steps for solving a problem. Algorithm methods: Pseudocode: Algorithm steps in a series of English-like statements. It uses a mixture of natural language and symbols, terms, and other features Flowchart: graphical representation of algorithm steps. (see Table 3.1). Structured algorithms and programs are designed using three basic methods of control: sequential, selection, and repetition.

1. Sequential Method: Steps are performed in a strictly sequential manner, each step being executed once. Example: Develop a computer algorithm that computes the area of a circle for a given radius.

Fortran Program program Area_of_a_circle Read *,r area=3.14*r**2 print*,R, area stop end program Area_of_a_circle START READ R A=  R 2 PRINT R,A STOP

2. Selection Method One of a number of alternative action is selected and executed. Example: Write an algorithm for computing the zakat of the total annual saving of a person. START READ TAS,A TAS<A Z=0.025TAZ Z=0 PRINT TAZ,Z STOP YESNO

3. Repetition Method One or more steps are performed repeatedly. Example: Write an algorithm (flow chart) for computing and printing the summation of the squares of integer numbers between 2 and 50. S =  N 2 START S=0, N=2 S=S+N 2 N=N+1 N  50 PRINT S STOP YES NO

EXAMPLES 1.Write an algorithm for computing and printing the arithmetic and engineering means for three variables, x, y, and z. Then write the Fortran program and execute it. Arithmetic Mean=(x+y+z)/3 Engineering Mean =(x+y+z) (1/3)