Algorithm and Programming Introduction Dr Ir Riri Fitri

  • Slides: 22
Download presentation
Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical

Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February 2009

Text Book • C++ How to Program, Fifth Edition • By H. M. Deitel

Text Book • C++ How to Program, Fifth Edition • By H. M. Deitel - Deitel & Associates, Inc. , P. J. Deitel - Deitel & Associates, Inc. • Publisher: Prentice Hall • Pub Date: January 05, 2005 • Print ISBN-10: 0 -13 -185757 -6 e • Text ISBN-10: 0 -13 -186103 -4 • Print ISBN-13: 978 -0 -13 -185757 -5 e • Text ISBN-13: 978 -0 -13 -186103 -9 • Pages: 1536

Chapter 1 Introduction

Chapter 1 Introduction

Programming • Programming: The process of making a program

Programming • Programming: The process of making a program

Programming Stages • Definition • Problem description • Design of steps to solve the

Programming Stages • Definition • Problem description • Design of steps to solve the problem algorithm – Using flow chart – Using Pseudocode • Coding

Problem definition Problem Description A Program Testing with computer Design and Coding Ready to

Problem definition Problem Description A Program Testing with computer Design and Coding Ready to use Program A

Problem definition A Coding Program Problem Description Algorithm Design Algorithm A Testing with Computer

Problem definition A Coding Program Problem Description Algorithm Design Algorithm A Testing with Computer Ready to use program

Programming • Algorithm written in programming language: Program • The process to change an

Programming • Algorithm written in programming language: Program • The process to change an algorithm to be a program: Coding • Every steps is prone to error: – Syntax Error compiler/interpreter – Logical Error

Programming • There is a program which can be executed without the need to

Programming • There is a program which can be executed without the need to be interpreter beforehand (with interpreter): – BASIC – d. BASE

Why Algorithm? • Obeying Rules syntax – Logical thinking • Limitation on capability; –

Why Algorithm? • Obeying Rules syntax – Logical thinking • Limitation on capability; – COBOL Large Data processing – FORTRAN Calculation

Why algorithm? • Program Self Characteristics: – Ways of thinking – Logical approach –

Why algorithm? • Program Self Characteristics: – Ways of thinking – Logical approach – Detailed problem description – Perseverance – Enthusiasm

Why Algorithm? • Overcome the problem with other general and free language: – natural

Why Algorithm? • Overcome the problem with other general and free language: – natural langunge – pseudo-code – flow chart • Separate the activity of algorithm design and coding.

Why Algorithm? • Natural Language unable to describe the problem solving stages with the

Why Algorithm? • Natural Language unable to describe the problem solving stages with the following character: – structured – detailed – unambiguious Very different from programming language.

Why Algorithm? • pseudo-code Good to describe algorithm, for the following character: – structured

Why Algorithm? • pseudo-code Good to describe algorithm, for the following character: – structured – detailed – clear

Why Algorithm? ? • Efficient program: Program which required minimum memory and fastest execution

Why Algorithm? ? • Efficient program: Program which required minimum memory and fastest execution time.

Algorithm Definition Steps to solve a problem or work which is defined as a

Algorithm Definition Steps to solve a problem or work which is defined as a systematic, detaild and clears, so that it can be conducted based on a particular condition, and can be completed in a limited time and produce results as required.

Algorithm Characteristic • • • Structured Efficient Detailed Unambiguous Independent

Algorithm Characteristic • • • Structured Efficient Detailed Unambiguous Independent

Algorithm Characteristics • Structured: – Consist of some steps, block, procedure and function. –

Algorithm Characteristics • Structured: – Consist of some steps, block, procedure and function. – One entry point and one exit point. – The control flow follows a particular pattern. – Easy to manage and develop.

Algorithm Characteristics • Eficient: – Optimized the use of memory and processor. • Time

Algorithm Characteristics • Eficient: – Optimized the use of memory and processor. • Time : – Processor to run command – Avoid long execution

Algorithm Characteristics • Detail : – Easy to be describe as one or more

Algorithm Characteristics • Detail : – Easy to be describe as one or more programming languange command. – Unambiguious • Independent – independent from any programming language.

Algorithm • Problem-> sub problem -> easy to conduct. • Smaller sub problem to

Algorithm • Problem-> sub problem -> easy to conduct. • Smaller sub problem to be completed. • Programming. • Top Down Design

Task: Install Devcpp 4. 9. 9. 2 Run the hello world Run the program

Task: Install Devcpp 4. 9. 9. 2 Run the hello world Run the program 2. 17 and modify for odd and even number