Problem Analysis
in Algorithm
Goals
• determine conditions  results
• perform problem analysis properly
Task 1 (pair)
Semarang Jakarta
free ticket immediately
Select one! Why?
Analysis
• Problem : Arrive Jakarta immediately
• Time (hour):
aeroplane 1
bus 6
train 5
• Solution ?
maximum minimum
Algorithm
• Compare time spent
aeroplane vs bus ?
result vs train?
Forward Thinking
Conditions :
(a < b) 
(a >= b) 
(a < t)  a
(a >= t)  t
(b < t)  b
(b >= t)  t
Backward Thinking
(a < b) and (a < t)
(a >= b) and (b < t)
(a >= t) and (b >= t)
 a
 b
 t
Result :
Problem Solving Direction
Forward
Backward
problem solution
Task 2 (group)
Categorize an input mark (range 0..100)
to decide grade (‘A’, ‘B’, ‘C’, ‘D’,or ‘E’)
Example :
mark grade
89 ‘A’
75 ‘B’
42 ‘E’
Leak Analysis
depend on NA:
0 ≤ NA < 50 : ‘E’
50 < NA < 60 : ‘D’
60 < NA < 70 : ‘C’
70 < NA < 80 : ‘B’
80 < NA ≤ 100 : ‘A’
Consideration
Ensure all conditions are handled
Reference
• Liem, Inggriani. 2003.
Algorithm and Programming. Bandung: ITB
Thank You

Problem Analisis dalam algoritma pemograman