algorithm and programming introduction dr. ir. riri fitri sari mm msc international class electrical...
TRANSCRIPT
![Page 1: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/1.jpg)
Algorithm and Programming Introduction
Dr. Ir. Riri Fitri Sari MM MScInternational Class
Electrical Engineering DeptUniversity of Indonesia
8 February 2009
![Page 2: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/2.jpg)
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-6e• Text ISBN-10: 0-13-186103-4• Print ISBN-13: 978-0-13-185757-5e• Text ISBN-13: 978-0-13-186103-9• Pages: 1536
![Page 3: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/3.jpg)
Chapter 1 Introduction
![Page 4: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/4.jpg)
Programming
• Programming: The process of making a program
![Page 5: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/5.jpg)
Programming Stages
• Definition
• Problem description
• Design of steps to solve the problem algorithm– Using flow chart– Using Pseudocode
• Coding
![Page 6: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/6.jpg)
Problem
Problem definition
Problem Description
Design and Coding
Program
Testing with computer
Ready to use
ProgramA
A
![Page 7: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/7.jpg)
Problem
Problem definition
Problem Description
Algorithm Design
Program
Testing with Computer
Ready to use program
A
Algorithm
Coding
A
![Page 8: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/8.jpg)
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
![Page 9: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/9.jpg)
Programming
• There is a program which can be executed without the need to be interpreter beforehand (with interpreter):– BASIC– dBASE
![Page 10: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/10.jpg)
Why Algorithm?
• Obeying Rules syntax– Logical thinking
• Limitation on capability; –COBOL Large Data processing
–FORTRAN Calculation
![Page 11: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/11.jpg)
Why algorithm?
• Program Self Characteristics:– Ways of thinking– Logical approach– Detailed problem description– Perseverance– Enthusiasm
![Page 12: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/12.jpg)
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.
![Page 13: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/13.jpg)
Why Algorithm?
• Natural Language
unable to describe the problem solving stages with the following character:– structured– detailed– unambiguious
Very different from programming language.
![Page 14: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/14.jpg)
Why Algorithm?
• pseudo-code
Good to describe algorithm, for the following character:– structured– detailed– clear
![Page 15: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/15.jpg)
Why Algorithm??
• Efficient program: Program which required minimum memory and fastest execution time.
![Page 16: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/16.jpg)
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.
![Page 17: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/17.jpg)
Algorithm Characteristic
• Structured
• Efficient
• Detailed
• Unambiguous
• Independent
![Page 18: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/18.jpg)
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.
![Page 19: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/19.jpg)
Algorithm Characteristics
• Eficient:
– Optimized the use of memory and processor. • Time :
–Processor to run command– Avoid long execution
![Page 20: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/20.jpg)
Algorithm Characteristics
• Detail : – Easy to be describe as one or more
programming languange command. – Unambiguious
• Independent– independent from any programming
language.
![Page 21: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/21.jpg)
Algorithm
• Problem-> sub problem -> easy to conduct.
• Smaller sub problem to be completed.
• Programming.
• Top Down Design
![Page 22: Algorithm and Programming Introduction Dr. Ir. Riri Fitri Sari MM MSc International Class Electrical Engineering Dept University of Indonesia 8 February](https://reader036.vdocument.in/reader036/viewer/2022062518/56649f305503460f94c4a24a/html5/thumbnails/22.jpg)
Task:Install Devcpp4.9.9.2Run the hello worldRun the program 2.17 and modify for odd and even number