# struktur data linier stack & queue, deque & list berkait ... Â· modul praktikum struktur data...

Post on 01-Feb-2018

247 views

Category:

## Documents

Embed Size (px)

TRANSCRIPT

• Modul Praktikum Struktur Data

Versi 16.03

Struktur Data Linier

Stack & Queue, Deque & List Berkait

Rekursi, Pencarian dan Pengurutan Binary Tree

Disusun oleh: Husni, MT.

Program Studi Teknik Informatika Fakultas Teknik

• 2

Daftar Isi

Daftar Isi ........................................................................................................................................ 2

Kata Pengantar .............................................................................................................................. 4

Lab 1: Python: List, String, Tuple, Set, Dictionary dan Class ......................................................... 5

1.0 Obyektif ............................................................................................................................... 5

1.1 List ....................................................................................................................................... 5

1.2 String ................................................................................................................................... 7

1.3 Tuple .................................................................................................................................... 8

1.4 Set ........................................................................................................................................ 8

1.5 Dictionary ............................................................................................................................ 9

1.6 Struktur Data Kelas: Mengenal Pendekatan Berorientasi Obyek ..................................... 11

1.8 Rangkuman ........................................................................................................................ 12

1.9 Tugas Pendahuluan ........................................................................................................... 12

1.10 Tugas Lanjutan ................................................................................................................ 12

1.11 Latihan Mandiri ............................................................................................................... 12

Lab 2: Stack & Queue .................................................................................................................. 14

2.0 Obyektif ............................................................................................................................. 14

2.1 Stack .................................................................................................................................. 14

2.2 Queue ................................................................................................................................ 20

2.3 Simulasi: Antrian Mencetak dalam Jaringan ..................................................................... 22

2.4 Rangkuman ........................................................................................................................ 26

2.5 Tugas Pendahuluan ........................................................................................................... 27

2.6 Tugas Lanjutan .................................................................................................................. 27

2.7 Latihan Mandiri ................................................................................................................. 28

Lab 3: Deque & Linked-List .......................................................................................................... 29

3.0 Obyektif ............................................................................................................................. 29

3.1 Deque ................................................................................................................................ 29

3.2 List Lanjutan ...................................................................................................................... 31

3.3 Rangkuman ........................................................................................................................ 37

3.4 Tugas Pendahuluan ........................................................................................................... 37

3.5 Tugas Lanjutan .................................................................................................................. 37

3.6 Latihan Mandiri ................................................................................................................. 37

• 3

Lab 4: Rekursi, Searching & Sorting ............................................................................................ 39

4.0 Obyektif ............................................................................................................................. 39

4.1 Pendekatan Rekursif ......................................................................................................... 39

4.2 Pencarian Item dalam List ................................................................................................. 40

4.3 Pengurutan ........................................................................................................................ 42

4.4 Rangkuman ........................................................................................................................ 44

4.5 Tugas Pendahuluan ........................................................................................................... 44

4.6 Tugas Lanjutan ............................................................................................................ 45

4.7 Latihan Mandiri ........................................................................................................... 45

Lab 5: Tree dan Algoritmanya ..................................................................................................... 47

5.0 Obyektif ............................................................................................................................. 47

5.1 Tree Berbasis List ............................................................................................................... 47

5.2 Tree dengan ...................................................................................................................... 50

Node & Referensi .................................................................................................................... 50

5.3 Parse Tree .......................................................................................................................... 52

5.4 Pola Penjelajahan Tree ...................................................................................................... 55

5.5 Antrian Berprioritas dengan Binary Heaps ........................................................................ 57

5.6 Binary Search Trees ........................................................................................................... 59

5.7 Rangkuman ........................................................................................................................ 63

5.8 Tugas Pendahuluan ........................................................................................................... 63

5.9 Tugas Lanjutan .................................................................................................................. 64

5.10 Latihan Mandiri ............................................................................................................... 64

• 4

Kata Pengantar

Alhamdulillah, modul praktikum Struktur Data edisi baru 16.03 ini dapat diselesaikan sesuai

dengan jadwal pelaksanaan praktikum yang ditetapkan. Modul ini berbeda 100% dengan

modul praktikum yang digunakan tahun sebelumnya (2015). Pada tahun ini, praktikum

Struktur Data menggunakan bahasa Pemrograman Python, begitu pula pembahasan dalam

modul ini, tepatnya Python versi 3 (terakhir 3.5.1).

Modul ini dibagi ke dalam 5 aktifitas lab yang direncanakan dapat dituntaskan dalam satu

semester Praktikum. Walaupun jumlah pertemuannya sedikit, namun kandungannya sudah

sangat mewakili konsep Struktur Data yang dibahas di kuliah, termasuk praktik tentang

struktur data linier, Stack, Antrian (Queue), Deque (antrian dua pintu), List, Linked-list (list

bersambungan), Tree (pohon biner), fungsi rekursif, Searching (pencarian) dan Sorting

(pengurutan). Satu-satunya jenis struktur data yang tidak dijelaskan dalam modul ini adalah

Graf (Graph). Graf merupakan materi terakhir dalam kuliah Struktur Data dan dapat dianggap

sebagai topik paling berat. Dua alasan tersebut menyebabkan graf tidak dimasukkan dalam

modul ini, mungkin dapat berubah di tahun depan.

Referensi utama dalam pembuatan modul ini adalah Problem Solving with Algorithms and Data Structures yang ditulis oleh Brad Miller dan David Ranum (dapat didownload di interactivepython.org/runestone/static/pythonds/index.html). Referensi lain yang sangat mendukung adalah buku Data Structures and Algorithms in Python karya Michael T. Goodrich, Roberto Tamassia dan Michael H. Goldwasser yang merupakan rujukan utama kuliah Struktur Data saat ini. Beberapa tulisan di Wikipedia juga turut melengkapi modul ini. Kami mengucapkan terimakasih kepada Program Studi Teknik Informatika Universitas Trunojoyo Madura yang telah mempercayakan kami menata kembali materi Praktikum Struktur Data m

Recommended