1 / 15

Pertemuan 6 TREE & BINARY TREE

Pertemuan 6 TREE & BINARY TREE. Matakuliah : T0034 / Perancangan & Analisis Algoritma Tahun : 2008. TREE. Terdapat sejumlah node (titik) yang terhubung atas susunan hierarkis parent (orang tua) dan child (anak). Sebuah child node pasti memiliki satu parent node.

Download Presentation

Pertemuan 6 TREE & BINARY TREE

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. Pertemuan 6TREE & BINARY TREE Matakuliah : T0034 / Perancangan & Analisis Algoritma Tahun : 2008

  2. TREE • Terdapat sejumlah node (titik) yang terhubung atas susunan hierarkis parent (orang tua) dan child (anak). • Sebuah child node pasti memiliki satu parent node. • Sebuah parent node bisa memiliki beberapa node lain yang berada di bawahnya (child node). [buku utama, bab 4.4]

  3. ILUSTRASI TREE [buku utama, ilustrasi 4.6]

  4. BINARY TREE (1) • Adalah sebuah tree yang setiap node-nya pasti memiliki 0 atau 2 child. • Jumlah maksimal node di level ke-k = 2k-1 • Jumlah maksimal node dalam Binary Tree kedalaman k = 2k-1 [buku utama, bab 4.4.1]

  5. BINARY TREE (2) • Impementasi bisa dengan array atau linked-list • Operasi yang dapat dilakukan : • Memasukkan / menambahkan data • Mencari data • Menghapus data • Sorting data

  6. ILUSTRASI BINARY TREE [buku utama, ilustrasi 4.7]

  7. TREE TRAVERSAL • Adalah proses mengunjungi setiap node dalam tree • Pre-order Traversal • parent–left–right • Level-order Traversal • parent–left–right (per level / kedalaman) • In-order Traversal • left–parent–right (teknik ini hanya berlaku bagi Binary Tree) • Post-order Traversal • left–right–parent [buku utama, bab 9.2]

  8. PRE-ORDER TRAVERSAL [buku utama, ilustrasi 9.6]

  9. LEVEL-ORDER TRAVERSAL [buku utama, ilustrasi 9.7]

  10. IN-ORDER TRAVERSAL [buku utama, ilustrasi 9.8]

  11. POST-ORDER TRAVERSAL [buku utama, ilustrasi 9.9]

  12. + 1 16 11 10 x x 12 2 9 15 4 3 13 14 2 – 3 b 5 8 7 6 a 1 EULER TOUR TRAVERSAL Arithmetic Expression Tree 2 x (a – 1) + (3 x b)

  13. LATIHAN • Uraikan perbedaan implementasi Tree dengan menggunakan array dan pointer!

  14. REVIEW • Apa yang sudah dipahami? • Apa yang akan dibahas selanjutnya?

More Related