1 / 22

Introduction to Algorithm Session 1

Introduction to Algorithm Session 1. Course : T0974-Algorithm & Object-Oriented Programming I Year : 2011. Learning Outcome. After taking this course, students should be expected to explain and discuss their own Algorithms. Lecture Outline. Definition of Algorithm

hien
Télécharger la présentation

Introduction to Algorithm Session 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to AlgorithmSession 1 Course : T0974-Algorithm & Object-Oriented Programming I Year : 2011

  2. Learning Outcome After taking this course, students should be expected to explain and discuss their own Algorithms.

  3. Lecture Outline • Definition of Algorithm • Characteristics of Algorithm • Programming Language • Algorithm Expression • Pseudocode • Flowchart • NS Diagram

  4. AlgorithmDefinition • A precise rule (or set of rules) specifying how to solve some problemwordnetweb.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

  5. Example • Sorting. This algorithm is used to arrange of items or number according of its size. • Input : a set of positive numbers (a1, a2, a3, …, an) 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.

  6. Characteristics of Algorithm • Input • Output • Definitness • Finiteness • Effectiveness An algorithm should have the following five characteristics :

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

  8. Expressing an Algorithm Expressing an Algorithm can be expressed using a method below : • Pseudocode • Flowchart • NS Diagram

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

  10. 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 Example of phone calls using pseudocode.

  11. 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 Example of Pseudocode to determine odd-even number

  12. Flowchart • Schematic representation of process or algorithm. • Schematic is a illustration of system in simplified or symbolic form.

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

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

  15. Start Input Number Number % 2 1 0 Print “Odd Number” Print “Even Number” END Flowchart Example of determining odd-even number

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

  17. NS Diagram • Process notation : • Selection notation: • Loop notation : • WHILE • DO-WHILE Proses Kondisi Betul Salah Kondisi Belum Terpenuhi Proses Kondisi Belum Terpenuhi Proses

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

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

  20. 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“

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

More Related