Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

Introduction to The Design & Analysis of Algorithms By INDRIATI Teknik Informatika - UB.

Presentasi serupa


Presentasi berjudul: "Introduction to The Design & Analysis of Algorithms By INDRIATI Teknik Informatika - UB."— Transcript presentasi:

1 Introduction to The Design & Analysis of Algorithms By INDRIATI Teknik Informatika - UB

2 See page 2; quoted: “..…. a person does not really understand something until after teaching it to someone else ……” actually: “ a person does not REALLY understand something until after teaching it to a computer.”

3 An algorithm is a sequence of unambiguous instructions for solving a problem, i.e. for obtaining a required output for any legitimate input in a finite amount of time.

4 What is algorithm? An algorithm is a sequence of computational steps that transform the input into the output An algorithm is a tool for solving a well- specified computational problem

5 Algorithm is.... Algoritma adalah cara yang dapat ditempuh oleh komputer dalam mencapai suatu tujuan, terdiri atas langkah-langkah yang terdefinisi dengan baik, menerima input, melakukan proses, dan menghasilkan output. Meskipun tidak selalu, biasanya sebuah algoritma memiliki sifat bisa dihitung (computable) atau bisa diukur (measurable).

6 An algorithm is written in pseudocode, i.e. a mixture of a natural language and programming language-like construct if – then if – then – else for – do while – do repeat – until

7 C SS2S1 C next statement if – thenif – then – else false true

8 for k  1 to n do done n times

9 C S next statement false true while – do

10 C S next statement true false repeat – until

11 1. understand the problem 2. ascertain the capabilities of the computational device 3. choose between exact and approximate problem solving 4. decide on appropriate data structures 5. determine algorithm design techniques 6. select the method of specifying an algorithm 7. prove the algorithm’s correctness 8. analyze the algorithm 9. code the algorithm STEPS

12 the most important problem types are: 1. sorting rearrange items of a given list in a specific order, based on some key 2. searching find a given search key in a given set 3. string processing search a word in a text next…

13 4. graph problems includes graph traversal problems, shortest-path algorithms, topological sorting, graph coloring problems 5. combinatorial problems e.g. traveling salesman next…

14 6. geometric problems the closest-pair problem, the convex hull problem 7. numerical problems solve equations & systems of equations, evaluate functions, etc.

15 PSEUDOCODE (1) Algorithm to display seven symbols of # 1 for i <- 1 to 7 do 2 display ”#” 3 end for

16 PSEUDOCODE (2) Algorithm to calculate Faktorial from N 1 iTemp <- 1 2 for i <- 1 to N do 3 iTemp <- iTemp*i 4 end for 5 display ”Factorial from ”,N,” is ”,iTemp [buku utama, pseudocode 2.8b]

17 PSEUDOCODE (3) Algorithm to display 8 Fibonacci number 1 f1 <- 0 2 f2 <- 1 3 for i <-1 to 8 do 4 iFibo <- f1+f2 5 display ”Number ”,i,” is ”,iFibo 6 f1 <-f2 7 f2<- iFibo 8 end for

18 LATIHAN Buatlah sebuah pseudocode untuk menampilkan N bilangan pertama secara terbalik. –contoh : 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 –Buat dengan menggunakan teknik for-do! –Buat dengan menggunakan teknik repeat- until! –Buat dengan menggunakan teknik while-do!

19 LATIHAN Buat sebuah pseudocode yang akan menerima sebuah bilangan X dari user. Tampilkan pesan “benar” jika X habis dibagi 2, 3 atau 7 dan tampilkan “salah” jika tidak habis dibagi.

20 Assignment Algorithm Efficiency Description Parameters Types and description Deadline: Sept 22, to : Subject : Algorithm Effieciency [NIM]


Download ppt "Introduction to The Design & Analysis of Algorithms By INDRIATI Teknik Informatika - UB."

Presentasi serupa


Iklan oleh Google