Fundamentals of Algorithms Budi Hartono, ST, MPM
Computer = problem solver ? • Well, .. It all depends It can be useful to help us, but … it must be pre-programmed
Computer = problem solver ? Do this !!!
??
If x then y
Do x !!!
ok
Computer = problem solver ? • Pre-programming = – Giving a set of instructions in advance • How the computer should behave
• Computer will follow the instructions – Fast – Accurate – Repetitive
Steps of Problem Solving using Computers
Programming Language • A sets of instructions: programming • The language • Writen language that the compie understands • Machine languages
Types of language • Low primitive machine-oriented – Directly executable (by compie)
• High people-oriented
Algorithms • Logical flow of solving a problem • Independent to the programming language
A
B
HOW ??
Algorithms Algorithm: Exchange_the_Content
1. Pour the blue water to A A
B
2. Pour the yellow water to B
HOW ??
Algorithms Algorithm: Exchange_the_Content A
B
1. Pour the blue water to C 2. Pour the yellow water to B 3. Pour the blue water to A
C
Another one
???
Important Notice • • • • •
Start & Stop Non-ambiguous There is (are) (an) input(s) There is (are) (an) output(s) Effective
Source: The art of computer programming, Knuth, Donald E., 1973
Algorithms • Heart of infomatics science & engineering • Used not only in computers !!
Process 1 2 3
Algorithms
Cake makers recipes Chemistry experiments experiment guidelines Car Assembly assembling flow
Example of steps …
How it works
Input devices
CPU
Output devices
memory Data Applications & OSs
The Steps ALGORITHMS TRANSLATION HIGH-LEVEL LANGUAGE COMPILATION MACHINE LANGUAGE INTERPRETATION OPERATIONS