1 / 8

Pertemuan 13 AVL Tree

Pertemuan 13 AVL Tree. Matakuliah : T0026/Struktur Data Tahun : 2005 Versi : 1/1. Learning Outcomes. Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : Mahasiswa dapat menghasilkan program modular untuk mengimplementasikan ADT AVL tree. Outline Materi.

Télécharger la présentation

Pertemuan 13 AVL 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 13AVL Tree Matakuliah : T0026/Struktur Data Tahun : 2005 Versi : 1/1

  2. Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : • Mahasiswa dapat menghasilkan program modular untuk mengimplementasikan ADT AVL tree

  3. Outline Materi • Pengertian dan penggunaan AVL tree • Contoh AVL Tree • Inerting data AVL tree • Deleting data AVL tree • Contoh program AVL Tree

  4. Introduced by Adelson-Velskii and Landis in 1962 Definition : TL and TR are height balanced |hL - hR|<=1 AVL Tree adalah Binary Search Tree yang mempunyai ketentuan : maksimum perbedaan height antara subtree kiri dan subtree kanan adalah satu Balance Factor, BF(T) : TallLeft : –1 TallRight : +1 Balance : 0 4 kinds of rebalancing : LL : left subtree of the left subtree RR : right subtree of the right subtree LR : right subtree of the left subtree RL : left subtree of the right subtree AVL Tree

  5. INSERT case 1 : BF(T)=0 Operation on AVL Tree Before Insert(80) After Insert(80) +1 0 54 54 +1 0 0 30 70 30 70 0 80 • case 2 : BF(T)=+1 Insert in left subtree for BF(T)=+1. After Insert(10) Before Insert(10) 0 54 +1 54 -1 +1 0 +1 30 70 30 70 0 0 0 10 80 80

  6. Case 3 : Insert in left subtree for BF(T)=-1 Case 4 : Insert in right subtree for BF(T)=+1 Case 5 : Insert in left subtree for BF(T)=+1 Case 6 : Insert in right subtree for BF(T)=-1 Operation on AVL Tree

  7. Single Rotation : LL, RR Operation on AVL Tree +1 +2 54 +1 54 54 0 0 0 +2 0 +1 30 80 30 70 LeftChild 30 70 0 0 +1 0 70 88 Parent 80 80 RightChild 88

  8. Double Rotation Operation on AVL Tree Before Insert(55) Insert(55) -2 -1 60 60 +1 +1 0 +1 20 20 80 80 -1 0 -1 0 0 +1 90 10 90 40 10 40 0 0 +1 0 0 0 5 30 5 50 30 50 55 R1 R2 0 40 60 -1 0 20 60 40 80 -1 0 +1 +1 30 50 80 10 90 20 50 0 0 0 5 55 90 10 30 55 5

More Related