1 / 24

Introduction to Algorithms

Introduction to Algorithms. Topik. Solving problems Algorithms Nilai dan v ariabel. Bgmn kita memecahkan masalah ?. Langsung kerjakan Tabak dan untung-untungan Trial error Pengalaman "Scientifically“ = dg cara ilmiah. Analysis. Problem specification. Design. Algorithm.

kineks
Download Presentation

Introduction to Algorithms

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. Introduction to Algorithms

  2. Topik • Solving problems • Algorithms • Nilai dan variabel

  3. Bgmn kita memecahkan masalah ? • Langsung kerjakan • Tabak dan untung-untungan • Trial error • Pengalaman • "Scientifically“ = dg cara ilmiah

  4. Analysis Problemspecification Design Algorithm Implementation Program Compilation Executable (solution) Process memcahkan masalah "Doctor, my head hurts" Patient has elevated pressure in anterior parietal lobe 1. Sterilize cranial saw 2. Anaesthetize patient 3. Remove top of skull 4. Get the big spoon... 5. etc., etc. sterilize(saw,alcohol); raise_hammer(); lower hammer(fast); start(saw); /* etc. etc. */ 0100111010110010101010101001010101010100110010101010101001011010011101010101010010010111010011110101010111110101010001101…

  5. Process memcahkan masalah "Dok, kepala saya sakit” Pasien ada penyumbatan pd anterior parietal lobe. Analysis Problem specification 1. Steril gergaji 2. bius 3. Potong batok kepala 4. Ambil spoon... 5. etc., etc. Design Algorithm Implementation steril(gergaji,alcohol); raise_hammer(); lower hammer(fast); start(saw); /* etc. etc. */ Program Compilation 010011101011001010101010100101010101010011001010101010100101101001110101010101001001011101001111010101011111010101000110100001101... Executable (solution)

  6. Process memcahkan masalah Analysis Problem specification Design Algorithm Implementation Program Compilation Executable (solution)

  7. Algorithm – Definisi From: Websters Revised Unabridged Dictionary, 1913: Algorism (Al"go*rism Al"go*rithm) • n. [OE. algorism, algrim, augrim, OF. algorisme, F. algorithme (cf. Sp. algoritmo, OSp. alguarismo, LL. algorismus) • Al-Khowarezmi aslinyaAbu Ja'far Mohammed ben Musa, ahli arithmetic awal abad 9, bukunya dalam bhs latin algorismus.

  8. Algorithm • Urutan instruksiuntuk menentukan langkah yang di perlukan dalam menyelesaikan suatu tugas. • Muhammad ibn Musa al-Khwarizmi Berasal dari Khowarezm (sekarang Khiva di Uzbekistan)

  9. Source: http://www.atlapedia.com/online/maps/political/Kazakh_etc.htm

  10. Algorithm– Sejarah Muhammad ibn Musa Al-Khwarizmi • Circa 160-230 A.H. (anno Hegirae) • Circa 780-850 C.E. (Common Era)

  11. Algorithm –Sejarah (lanj) Muhammad ibn Musa Al-Khwarizmi http://www-groups.dcs.st-andrews.ac.uk/~history/Mathematicians/Al-Khwarizmi.html • Buku arithmetic: • Hindu numeration, decimal numbers, use of zero, method for finding square root • Latin translation (c.1120 CE): “Algoritmi de numero Indorum” • Book aljabar algebra • Hisab al-jabr w’al-muqabala

  12. Algorithm – Working Definition • Urutan langkah yang menggambarkan bagaimana melakukan suatu pekerjaan [As opposed to actually executing the instructions]

  13. Algorithm -- Contoh • Resep masakan • Instruksi Assembly • Aturan main game • Instruksi VCR • Deskripsi teknik bela diri • Arahan dari A to B • Pola jahitan • Manual perbaikan mobil

  14. Algorithm: A sequence of instructions describing how to do a task (or process) Problem C Program From Algorithms to Programs

  15. Komponen Algorithm • Variabel dan Nilai • Instruksi • Sequences (Urutan) • Procedures (Prosedur) • Selections (Pilihan) • Repetitions (Perulanagan) • Documentation

  16. Nilai • Mewakili kuantitas, jumlah atau pengukuran • Bisa numeri atau alphabetical (atau lainnya) • Biasanya memiliki unit yang berhubungan dengan tujuannya

  17. Variable Values 10 kue 50 grams gula 3 potong roti dll. Tolpes Dapat berisi Variabel • Adalah container untuk nilai– tempat untuk menyimpan nilai • Contoh :

  18. Batasan Variabel • Variabel dibatasi oleh nilai tipe yang di spesifikasikan

  19. Komponen Algorithm • Nilai dan Variabel • Instruksi (primitive) • Sequence (dr instruction) • Procedure (yg melibatkan instruction) • Selection (antara instruction) • Repetition (dr instruction) • Documentation (disamping instruction)

  20. Instruksi (Primitives) • Suatu action yang simple... • ...dan jelas... • ...komputer mengerti... • ...dapat diaktualisasikan

  21. Instruksi– Examples Directions to perform specific actions on values and variables. • Take off your shoes • Count to 10 • Cut alongdotted line • Jahit 1 • Purl 2 • tarik benang pelan-pelan • Bubuhkan 10 grams arsenic

  22. Instruksi -- Application • Beberapa instruksi dapat hanya di aplikasikan pada nilai atau variabel yang di spesifikasikan. • Contoh:

  23. Instruksi (Primitives) -- Recommendations • Jika menulis algorithm, buat instruksi yang simple dan jelas • Contoh: Potong ayam kecil-kecil. Panaskan minyak. Masak ayam 5 menit Potong ayam kecil-kecil dan masak potongan tersebut pada minyak yang panas

  24. Instruksi (Primitives) “Urutan” dari instruksi yang simple. • When writing an algorithm, make the instructions simple and unambiguous. • Example: Potongayamkecil-kecil. Panaskanminyak. Masakayam 5 menit Potongayamkecil-kecildanmasakpotongantersebutpadaminyak yang panas

More Related