1 / 22

Kuliah Ke-4

Kuliah Ke-4 . Antrian / Queue (Bab 4). Informatics Engineering Dept TRUNOJOYO UNIVERSITY. Kita lanjutkan untuk yang satu ini …. ANTRIAN / QUEUE. Struktur Data. Definisi :

chyna
Download Presentation

Kuliah Ke-4

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. Kuliah Ke-4 Antrian / Queue (Bab 4) Informatics Engineering DeptTRUNOJOYO UNIVERSITY

  2. Kita lanjutkan untuk yang satu ini …..

  3. ANTRIAN / QUEUE Struktur Data • Definisi: • struktur data (mirip stack) yang memperbolehkan penyisipan di belakang (rear) dan penghapusan elemen di depan (front) • Contoh : • Penjualan karcis kereta, bioskop • Penjadualan pencetakan (spooling system) • Penjadualan pemakaian CPU • Pemakaian I/O pada sistem komputer • Penyimpan barang di Apotek

  4. MODEL ANTRIAN / QUEUE Struktur Data Kosong 1 Elemen 4 Elemen D Belakang Belakang Belakang 0 1 4 C B Depan Depan Depan A A 0 1 1

  5. OPERASI DASAR A n t r I a n • Dua operasi dasar ANTRIAN : • TAMBAH • AMBIL AMBIL TAMBAH

  6. TAMBAH ELEMEN Struktur Data Antrian Depan = 0 B A C D Belakang = 0 Depan = 1 Depan = 1 Belakang = 4 Belakang = 2 Depan = 1 Depan = 1 Belakang = 1 Belakang = 3

  7. AMBIL ELEMEN Struktur Data Antrian B A C D Ambil 1 elemen Geser antrian Depan = 1 Belakang = 3

  8. AMBIL ELEMEN Struktur Data Antrian C B D Ambil 1 elemen Geser antrian Depan = 1 Belakang = 2

  9. AMBIL ELEMEN Struktur Data Antrian D C Ambil 1 elemen Geser antrian Depan = 1 Belakang = 1

  10. AMBIL ELEMEN Struktur Data Antrian D Ambil 1 elemen Depan = 0 Belakang = 0

  11. KAMUS DATA Antrian Kamus Data : Q : array [1..4] of Char Depan : Integer Belakang : Integer Q Belakang 0 Depan 0

  12. Kondisi Antrian Struktur Data Kosong 1 Elemen Penuh D Belakang Belakang Belakang 0 1 4 C B Depan Depan Depan A A 0 1 1

  13. ANTRIAN SIRKULER A n t r I a n Model ini sama dengan antrian biasa, hanya saja : TIDAK ADA PERGESERAN AMBIL TAMBAH

  14. TAMBAH ELEMEN Antrian Sirkuler Depan = 0 B A C D Belakang = 0 Depan = 1 Depan = 1 Belakang = 4 Belakang = 2 Depan = 1 Depan = 1 Belakang = 1 Belakang = 3

  15. AMBIL ELEMEN Antrian Sirkuler Ambil 1 elemen B A C D Depan = 2 Belakang = 4

  16. AMBIL ELEMEN Antrian Sirkuler Ambil 1 elemen B C D Depan = 3 Belakang = 4

  17. AMBIL ELEMEN Antrian Sirkuler Ambil 1 elemen C D Depan = 4 Belakang = 4

  18. TAMBAH ELEMEN Antrian Sirkuler Tambah 1 elemen E D Depan = 4 Belakang = 1

  19. TAMBAH ELEMEN Antrian Sirkuler Tambah 1 elemen F E D Depan = 4 Belakang = 2

  20. TAMBAH ELEMEN Antrian Sirkuler Tambah 1 elemen F E G D Depan = 4 Belakang = 3

  21. TAMBAH ELEMEN Antrian Sirkuler Tambah 1 elemen F E G D Antrian Overflow Depan = 4 Belakang = 3

  22. Kondisi Antrian Sirkuler Struktur Data Kosong 1 Elemen Penuh D Belakang Belakang Belakang 0 1 4 C B Depan Depan Depan A A 0 1 1

More Related