1 / 19

Desain dan Analisis Algoritma

Desain dan Analisis Algoritma. Pertemuan 5 Asymptotic Notations. Latihan. Tentukan kelas OOG algoritma Tower of Hanoi. Latihan. algorithm secret(n) //input bilangan bulat positif n If n = 1 return 1 else return secret ([n / 2]) + 1. Apa yang dilakukan algoritma secret?

amiel
Download Presentation

Desain dan Analisis Algoritma

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Desain dan Analisis Algoritma Pertemuan 5 Asymptotic Notations

  2. Latihan Tentukan kelas OOG algoritma Tower of Hanoi

  3. Latihan algorithm secret(n) //input bilangan bulat positif n If n = 1 return 1 else return secret ([n / 2]) + 1 Apa yang dilakukan algoritma secret? Tentukan kelas OoG algoritma secret

  4. Kelas-kelas Orders of Growth C constant logN logarithmic N linear NlogN N2 quadratic N3 cubic 2N exponential N! factorial Makin ke bawah, OoGnya makin besar

  5. Apakah kita selalu bisa menentukan persamaan T(n) secara eksak? • Untuk kasus sederhana mungkin bisa • Untuk algoritma yang rumit jarang bisa

  6. Tentukan T(n) & kelas OoG algoritma berikut Algorithm polinom(x, P[0..n]) //algoritma untuk menghitung nilai polinom //y = P[0]x0+P[1]x1+ P[2]x2+…+ P[n]xn //input : x & P[0..n] //output : y y ← 0 for i ← 0 to n do y = y + P[0] * xi return(y)

  7. Big Omega t(n) Є Ω(f(n)) • Baca : OoG t(n) ada di omega f(n) • t(n) Є Ω(f(n)) jika OoG t(n) ≥ OoG f(n) • Contoh, untuk algoritma polinom t(n) Є Ω(n) • Contoh 3n3Є Ω(n2), 0.5n(n - 1) Є Ω(n2)

  8. Big Omega grafik

  9. Big Omega Untuk membuktikan apakah t(n) Є Ω(f(n)) OoG t(n) ≥ OoG f(n) • Limit • Jika ada konstanta c dan integer positif no sedemikian hingga t(n) >= cf(n) untuk semua n ≥ no

  10. Big Omega • Buktikan bahwa n3Є Ω(n2)

  11. Big Oh t(n) Є O(f(n)) • Baca : OoG t(n) ada di O f(n) • t(n) Є O(f(n)) jika OoG t(n) ≤ OoG f(n) • Contoh 7n Є O(n2), 100n + 5 Є O(n2), 0.5n(n - 1) O(n2)

  12. Big Oh grafik

  13. Big Oh Untuk membuktikan apakah t(n) Є O(f(n)) OoG t(n) ≤ OoG f(n) • Limit • Jika ada konstanta c dan integer positif no sedemikian hingga t(n) ≤ cf(n) untuk semua n ≥ no

  14. Big Oh • Buktikan bahwa 100n + 5 Є O(n2)

  15. Big theta t(n) ЄӨ(f(n)) • Baca : OoG t(n) ada di Ө f(n) • t(n) ЄӨ(f(n)) jika OoG t(n) = OoG f(n) • Contoh 2n2 + log n ЄӨ(n2), 2n4 + 3n2ЄӨ(n4)

  16. Big theta grafik

  17. Big theta Untuk membuktikan apakah t(n) ЄӨ(f(n)) OoG t(n) = OoG g(n) • Limit • Jika ada konstanta c1, c2 dan integer positif no sedemikian hingga c2g(n) ≤ t(n) ≤ c1g(n) untuk semua n ≥ no

  18. Big theta • Buktikan bahwa 0.5n(n - 1) ЄӨ(n)

  19. Tugas Tugas latihan 2.4 no 1, 3, 4, 8 Dapat didownload di mariefh.lecture.ub.ac.id Dipresentasikan pada pertemuan 6 oleh mahasiswa dengan nomor_urut_absen % 10 == 1

More Related