algorithm and programming introduction dr. ir. riri fitri sari mm msc international class electrical...

Post on 14-Jan-2016

222 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Algorithm and Programming Introduction

Dr. Ir. Riri Fitri Sari MM MScInternational Class

Electrical Engineering DeptUniversity of Indonesia

8 February 2009

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

Chapter 1 Introduction

Programming

• Programming: The process of making a program

Programming Stages

• Definition

• Problem description

• Design of steps to solve the problem algorithm– Using flow chart– Using Pseudocode

• Coding

Problem

Problem definition

Problem Description

Design and Coding

Program

Testing with computer

Ready to use

ProgramA

A

Problem

Problem definition

Problem Description

Algorithm Design

Program

Testing with Computer

Ready to use program

A

Algorithm

Coding

A

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 be interpreter beforehand (with interpreter):– BASIC– dBASE

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– Detailed problem description– Perseverance– Enthusiasm

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 following character:– structured– detailed– unambiguious

Very different from programming language.

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 time.

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 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 :

–Processor to run command– Avoid long execution

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 be completed.

• Programming.

• Top Down Design

Task:Install Devcpp4.9.9.2Run the hello worldRun the program 2.17 and modify for odd and even number

top related