Download presentation

Presentation is loading. Please wait.

Published bySabina Simmons Modified over 2 years ago

2
Introduction to Algorithm Session 1 Course: T0974-Algorithm & Object-Oriented Programming I Year: 2011

3
Bina Nusantara University 3 Learning Outcome After taking this course, students should be expected to explain and discuss their own Algorithms.

4
Lecture Outline Definition of Algorithm Characteristics of Algorithm Programming Language Algorithm Expression Pseudocode Flowchart NS Diagram Bina Nusantara University 4

5
Algorithm Definition A precise rule (or set of rules) specifying how to solve some problem wordnetweb.princeton.edu/perl/webwn wordnetweb.princeton.edu/perl/webwn A procedure used to solve a mathematical or computational problem or to address a data processing issue. In the latter sense, an algorithm is a set of step- by-step commands or instructions designed to reach a particular goal. www.colorado.edu/geography/gcraft/gloss/glossary.html www.colorado.edu/geography/gcraft/gloss/glossary.html Bina Nusantara University 5

6
Example Sorting. This algorithm is used to arrange of items or number according of its size. –Input: a set of positive numbers (a 1, a 2, a 3, …, a n ) e.g. 5, 3, 4, 2, 1 –Output: a set of arranged numbers (a’ 1, a’ 2, a’ 3, …, a’ n ) e.g. 1, 2, 3, 4, 5 Example of problems which solved using an Algorithm. –Human Genome Project to identify 100.000 of human DNA genes. –Search Engines (Yahoo, Google, etc) –GPS Tracking System. Bina Nusantara University 6

7
Characteristics of Algorithm Input Output Definitness Finiteness Effectiveness Bina Nusantara University 7 An algorithm should have the following five characteristics :

8
Programming Language A sequence of instructions that a computer can interpret and execute) "the program required several hundred lines of code” --wordnetweb.princeton.eduwordnetweb.princeton.edu Instruction is a line of code written as part of a computer program –wordnetweb.princeton.eduwordnetweb.princeton.edu Example : –COBOL (Common Business Oriented Language) –FORTRAN (FORmula TRANslation) –Ada (Ada Lovelace) –C –C++ (C Based Object-Oriented Programming Languange) –Java Bina Nusantara University 8

9
Expressing an Algorithm Expressing an Algorithm can be expressed using a method below : Pseudocode Flowchart NS Diagram Bina Nusantara University 9

10
Psedocode Pseudocode (pronounced SOO-doh-kohd) is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled natural language rather than in a programming language.— WhatIs.com WhatIs.com Bina Nusantara University 10

11
Pseudocode BEGIN Hold up the phone WHILE not dial Press dial button WHILE not connected Waiting dial IF connected THEN WHILE not finish Talking Hold down the phone END Bina Nusantara University 11 Example of phone calls using pseudocode.

12
Pseudocode BEGIN Number = Input Number Result = Number % 2 IF Result = 0 THEN Print “The number is even number” ELSE THEN Print “The number is odd number” END Bina Nusantara University 12 Example of Pseudocode to determine odd-even number

13
Flowchart Schematic representation of process or algorithm. Schematic is a illustration of system in simplified or symbolic form. Bina Nusantara University 13

14
Bina Nusantara Flowchart Notasi Proses, Data Entry Selection : Flow Lines : Input/Output: Stop Notation : RECTANGLE DIAMOND Start PARALLELOGRAM CIRCLE END Every algorithm process is usually starts from And ends by

15
Bina Nusantara Flowchart Example of Phone Calling Flowchart Hold up the phone Press dial button Waiting Start Dialing No Yes Connected No Yes Talking Finish No Yes Hold down the phone END

16
Bina Nusantara Flowchart Example of determining odd-even number Start Input Number Number % 2 Print “Odd Number”Print “Even Number” 01 END

17
Bina Nusantara NS Diagram NS Diagram is a graphical illustration of structured progamming design. Its method is by drawing a table for illustrating an algorithm. Founded in 1972 by Isaac Nassi & Ben Shneiderman. Known as structograms.

18
Bina Nusantara NS Diagram Process notation : Selection notation: Loop notation : –WHILE –DO-WHILE Proses Kondisi BetulSalah Kondisi Belum Terpenuhi Proses Kondisi Belum Terpenuhi Proses

19
Bina Nusantara NS Diagram Example of Phone Calling process using NS Diagram Hold up the phone Dialing? Press dial button Finish? Talking Hold down the phone

20
Bina Nusantara NS Diagram Insert number Print “Even Number” Number % 2 Equal to 0Equal to 1 Print “Odd Number” Example of NS Diagram to determine odd-even numbers

21
Did you know ? The word "algorithm" comes from the name of the ninth- century Persian mathematician Mohammed al- Khowarizmi. He wrote a widely read book entitled Kitab al jabr w'al-muqabala (Rules of Restoration and Reduction) in the year of 825. This book describes many procedures for the manipulation of decimal numbers. The word was translated into Latin in the twelve century as “Algoritmi de numero Indorum“ or “Algoritmus on the numbers of the Indians“ Bina Nusantara University 21

22
Bina Nusantara Referensi Introduction to Algorithms. 2ed. Cormen. 2002. p5- 13 Introduction to Java Programming. 8ed. Liang. 2011. p29-30 Algorithm. http://en.wikipedia.org/wiki/Algorithmhttp://en.wikipedia.org/wiki/Algorithm Pseudocode. http://en.wikipedia.org/wiki/Pseudocode http://en.wikipedia.org/wiki/Pseudocode Flowchart. http://en.wikipedia.org/wiki/Flowcharthttp://en.wikipedia.org/wiki/Flowchart NS Diagram. http://en.wikipedia.org/wiki/NS_Diagram http://en.wikipedia.org/wiki/NS_Diagram

Similar presentations

Presentation is loading. Please wait....

OK

Algorithms and Flowcharts

Algorithms and Flowcharts

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google