Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Pemrograman komputer 1 (algoritma)

3,757 views

Published on

unj fmipa-fisika

Published in: Education
  • Be the first to comment

Pemrograman komputer 1 (algoritma)

  1. 1. Pemrograman Komputer Pertemuan 01 Algorithm Bambang Heru Iswanto, Dr.rer.nat M.Si <ul><li>Jurusan Fisika </li></ul><ul><li>Fakultas Matematika dan Ilmu Pengetahuan Alam </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  2. 2. Learning Outcomes <ul><li>Pada akhir pertemuan ini, diharapkan mahasiswa </li></ul><ul><li>akan mampu : </li></ul><ul><li>Menerapkan prinsip – prinsip dasar algoritma menggunakan pseudo code dan flowchart </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  3. 3. Outline Materi <ul><li>History of Algorithm </li></ul><ul><li>Algorithm Definition </li></ul><ul><li>Algorithm Implementation </li></ul><ul><li>Examples of Algorithm </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  4. 4. <ul><li>The word algorithm comes from the name of the 9th century Persian mathematician Abu Abdullah Muhammad bin Musa al-Khwarizmi. </li></ul><ul><li>The word algorism originally referred only to the rules of performing arithmetic using Arabic numerals but evolved into algorithm by the 18th century. The word has now evolved to include all definite procedures for solving problems or performing tasks. </li></ul><ul><li>The first case of an algorithm written for a computer was Ada Byron's notes on the analytical engine written in 1842, for which she is considered by many to be the world's first programmer. </li></ul><ul><li>The lack of mathematical rigor in the &quot;well-defined procedure&quot; definition of algorithms posed some difficulties for mathematicians and logicians of the 19th and early 20th centuries. This problem was largely solved with the description of the Turing machine, an abstract model of a computer formulated by Alan Turing. </li></ul><ul><li>Nowadays, a formal criterion for an algorithm is that it is a procedure that can be implemented on a completely-specified Turing machine or one of the equivalent formalisms. </li></ul>History of Algorithm Abu Abdullah Muhammad bin Musa al-Khwarizmi 01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  5. 5. Algorithm Definition <ul><li>Algorithm is a finite set of well-defined instructions for accomplishing some task which, given an initial state, will terminate in a corresponding recognizable end-state </li></ul><ul><li>In short, a lgorithm is a step–by–step procedure to solve a problem </li></ul><ul><li>Computer has no intelligence of its own – it cannot solve our mistakes! </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  6. 6. Algorithm Implementation <ul><li>Flowchart </li></ul><ul><ul><li>a schematic representation of a process. They are commonly used in business/economic presentations to help the audience visualize the content better, or to find flaws in the process </li></ul></ul><ul><li>Pseudocode </li></ul><ul><ul><li>a generic way of describing an algorithm using the conventions of programming languages. As the name suggests, pseudocode generally does not actually use the syntax of any particular language; there is no systematic standard form, although any particular writer will generally borrow the appearance of a particular language </li></ul></ul><ul><ul><li>depending on the writer, pseudocode may therefore vary widely in style, from a near-exact imitation of a real programming language at one extreme, to a description approaching formatted prose at the other </li></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  7. 7. Algorithm Implementation - Flowchart Common Flowchart Symbols Terminal : Start or end of a program Computational steps or processing function of a program Input or output operation Decision making and branching Connector or joining of two parts of program Flow Line 01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  8. 8. Algorithm Implementation - Flowchart A simple flowchart for what to do if a lamp doesn't work 01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  9. 9. Algorithm Examples – Wake Up <ul><li>We use algorithms all the time. Here is a typical algorithm for waking up in the morning. </li></ul><ul><li>Wake-up algorithm: </li></ul><ul><li>Get out of bed </li></ul><ul><ul><li>Brush teeth </li></ul></ul><ul><ul><li>Eat breakfast </li></ul></ul><ul><ul><li>Take shower </li></ul></ul><ul><ul><li>Get dressed </li></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  10. 10. Algorithm Examples – Temperature Conversion <ul><li>The local weather centre wants a computer program that will accept a temperature reading in degrees Fahrenheit as input, convert the value to degrees in Celsius and provide both values as output, for its hourly weather report. </li></ul><ul><ul><li>Develop the program logic as flowchart and pseudocode needed to solve the problem </li></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  11. 11. Algorithm Examples – Temperature Conversion <ul><li>Pseudocode: </li></ul><ul><li>Input degreesF </li></ul><ul><li>degreesC = (degreesF-32) * 5/9 </li></ul><ul><li>Output degreesF and degreesC </li></ul>Start Input degreesF degreesC = (degreesF-32) * 5/9 Output degreesF and degrees C End <ul><li>Flowchart : </li></ul>Convert degreesF to degrees C Or 01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  12. 12. Algorithm Examples – Exercises <ul><li>Sales Application: </li></ul><ul><ul><li>In a company, a salesperson’s pay is determined by how much they have sold in a month. Sales are of two types, items sold at regular price and those at sale price. Each person is paid a base amount of £920 plus a commission of 6% on regular-price sales and 3% on reduced-price sales. </li></ul></ul><ul><ul><li>Design the algorithm (program logic) to calculate their pay. </li></ul></ul><ul><li>Average Mark: </li></ul><ul><ul><li>A student gains 45, 53, 58 marks in three tests. </li></ul></ul><ul><ul><li>Design an algorithm to input that information and output their average mark. </li></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  13. 13. TERIMA KASIH 01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

×