Kesimpulan Pokok Tentang Algoritma
Ø Algoritma harus benar.
Ø Algoritma harus berhenti,
Ø Setelah berhenti, algoritma memberikan hasil
yang benar.
Cara Penulisan Algoritma
• Structured English (SE) / Notasi deskriptif
• Pseudocode
• Flowchart.
ALGORITHMS AND FLOWCHARTS
• Computer programming can be divided into two
phases:
• Problem solving phase
• Make an ordered sequence of steps that solves a problem
• these sequence of steps is called an algorithm
• Implementation phase
• implement using a programming language
Steps in Problem Solving
• First produce a general algorithm (one can use pseudocode)
• Refine your steps until you get to an easy sequence. Perhaps use
numbers or bullets.
The point is to simplify.
• Pseudocode is an artificial and informal language that helps
programmers develop
algorithms.
Pseudocode may be an informal
english, combinations of computer languages and
spoken language.
Whatever works for you.
Pseudocode
Pseudo berarti imitasi atau tiruan atau menyerupai,
code menunjuk pada kode program. Sehingga
pseudocode adalah kode yang mirip dengan instruksi kode
program
Pseudocode didasarkan pada bahasa pemrograman
sesungguhnya seperti BASIC, FORTRAN, PASCAL.
Apabila Contoh 1 ditulis dalam pseudocode berbasis
bahasa BASIC akan tampak seperti pada contoh 3 berikut :
Contoh Pseudocode
1. Start
2. READ alas, tinggi
3. Luas = 0.5 * alas * tinggi
4. PRINT Luas
5. Stop
pseudocode diatas berbasis bahasa BASIC
Pseudocode & Algorithm
• Example 1:
Write an algorithm to determine a student’s final grade and indicate
whether it is passing or failing. The final grade is calculated as the
average of four marks.
Pseudocode & Algorithm
Pseudocode:
• Input a set of 4 marks
• Calculate their average by summing and dividing by 4
• if average is below 60
Print “FAIL”
else
Print “PASS”
Pseudocode & Algorithm
• Detailed Algorithm
• Step 1: Input M1,M2,M3,M4
• Step 2: GRADE ¬ (M1+M2+M3+M4)/4
• Step 3: if (GRADE < 60) then
Print “FAIL”
else
Print “PASS”
endif.
The Flowchart
A Flowchart is another algorithm but graphical.
• shows logic solution
• emphasizes individual steps and their interconnections
• A flowchart must have a start and stop
• A steps in a flowchart must connect. Can’t leave a step
“hanging” with no connection.
e.g. control flow from one action to the next
URL’s for free Flowcharting software :
• www.smartdraw.com
• www.gliffy.com/uses/flowchart-software/
• www.breezetree.com/flowcharting-software/Flowchart Software, FREE Flowchart Examples and Templates
• www.edrawsoft.com/flowchart.php
Selasa, 15 November 2016
Langganan:
Posting Komentar (Atom)

0 komentar:
Posting Komentar